1 / 10

Composition Steps

Composition Steps. 01/10/2013. Agenda. Retooling note Define composition Wrapper without function pointer Compositions (thus far ) Evolutionary computation discussion. Retooling. Issue found with codebase Compiled with .cc extension defaulted to g++

marc
Download Presentation

Composition Steps

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Composition Steps 01/10/2013

  2. Agenda • Retooling note • Define composition • Wrapper without function pointer • Compositions (thus far) • Evolutionary computation discussion

  3. Retooling • Issue found with codebase • Compiled with .cc extension defaulted to g++ • Can’t use member functions in structs in C • Code moved to a “proper” C implementation that compiles with gcc

  4. Define Composition • Standard definition: • “has-a” • Implies ownership from parent class • Destroyed when parent is destroyed • Will we have cases where this implication is not valid • i.e. aggregation?

  5. Wrapper - No Function Pointer • Wrapper function called from main • Passed in target data structure • Wrapper implements Sorter class • Calls merge sort directly • Copies over sorted data into target data structure upon completion

  6. Composition Steps • Function pointer (same return type / parameters) • Add function pointer to data producer struct • Pass in algorithm function to struct • Ensure that data is either formatted in place or handled after called

  7. Composition Steps • Function pointer (different return types / parameters) • Similar approach to previous • Create wrapper that matches function pointer • Call necessary function inside wrapper • Ensure data is copied correctly

  8. Composition Steps • Wrapper without function pointer • Instantiate struct in wrapper function • Call desired algorithm directly in wrapper • Copy data over into desired data consumer

  9. eBook Find • Object-Oriented Programming with ANSI-C • http://www.cs.rit.edu/~ats/books/ooc.pdf • Discusses methods for implementing OO concepts in ANSI-C • Inheritance • Polymorphism • Delegation • Etc. • Plan is to migrate the simple Sorting struct into a framework that can support some of the design patterns presented as-is • Wrapper • Strategy

  10. Evolutionary Computation Discussion • Looking into framework development as we develop our genome • Developing infrastructure • Genome data structure • If genetic programming, stack or tree • If genetic algorithm, vector or array • Any limitations on language for EC program? • Evolved programs must be C-compilable, however can we use C++ for the infrastructure?

More Related