LRAUV  revA
Module.h
Go to the documentation of this file.
1 
16 #ifndef MODULE_H_
17 #define MODULE_H_
18 
19 #include "utils/Str.h"
20 
21 #include "component/Component.h"
22 #include "component/Behavior.h"
23 
24 class Slate;
25 
45 class Module
46 {
47 public:
49  virtual ~Module();
50 
53 
55  virtual const Str &getName() const;
56 
58  virtual const Str &getDescription();
59 
61  virtual void loadComponents( Logger& logger ) = 0;
62 
63  void registerComponent( Component *comp );
64 
65  void registerBehaviorCreator( const Str& creatorName, BehaviorCreator behaviorCreator );
66 
67  void unregisterComponent( Component *comp );
68 
69 protected:
71  Module( Str name, Str description );
72 
75 
76  //std::vector<Component*> components_;
78 
79  bool loadAtStartup( const ConfigURI& loadCfg, Logger& logger, bool forceIfMissing = false );
80 
81 private:
82  // Note that the copy constructor below is private and not given a body.
83  // Any attempt to call it will return a compiler error.
84  Module( const Module& old ); // disallow copy constructor
85 
86 };
87 
89 
95 typedef Module* create_module_t ();
96 
102 typedef void destroy_module_t ( Module* );
103 
104 #endif /*MODULE_H_*/
Client-side interface for injecting log data into the log queue.
Definition: Logger.h:30
Module(Str name, Str description)
Protected constructor for abstract base class.
Definition: Module.cpp:101
Behavior *(* BehaviorCreator)(const Str &, const Module *module)
Behavor factory interfaces.
Definition: Behavior.h:137
void unregisterComponent(Component *comp)
Definition: Module.cpp:67
virtual void loadComponents(Logger &logger)=0
loads the collection of components belonging to this module
Contains the Component class definition.
virtual ~Module()
destructor
Definition: Module.cpp:17
virtual FlexArray< Component * > * getComponents()
returns a vector of components in the module
Definition: Module.cpp:37
Str description_
Definition: Module.h:74
Definition: ElementURI.h:166
Contains the Behavior class definition.
Module is the abstract base class for a collection of Component objects that can be contained in a lo...
Definition: Module.h:45
Str name_
Definition: Module.h:73
Replacement for standard template class string.
Definition: Str.h:12
Abstract Base class for software components.
Definition: Component.h:53
Module * create_module_t()
Class factories.
Definition: Module.h:95
bool loadAtStartup(const ConfigURI &loadCfg, Logger &logger, bool forceIfMissing=false)
Definition: Module.cpp:89
FlexArray< Component * > components_
Definition: Module.h:77
void registerBehaviorCreator(const Str &creatorName, BehaviorCreator behaviorCreator)
Definition: Module.cpp:62
Code unit that represents the slate.
Definition: Slate.h:73
virtual const Str & getDescription()
returns a description of the module
Definition: Module.cpp:49
virtual const Str & getName() const
returns the name of the module
Definition: Module.cpp:43
void registerComponent(Component *comp)
Definition: Module.cpp:54
void destroy_module_t(Module *)
destroy_module must be implemented, following the class implementation: extern "C" void destroy(Modul...
Definition: Module.h:102