LRAUV  revA
DefineBehavior.h
Go to the documentation of this file.
1 
9 #ifndef DEFINEBEHAVIOR_H_
10 #define DEFINEBEHAVIOR_H_
11 
12 #include "component/Behavior.h"
13 
14 class DefinedBehavior;
15 class Method;
16 class MethodInfo;
17 class MissionNode;
18 class Module;
19 class ScriptAPI;
20 
27 {
28 public:
29  SettingInfo( const Str& name, const Str& uriPart, DataValue* defaultValue )
30  : name_( name ),
31  uriPart_( uriPart ),
32  defaultValue_( defaultValue )
33  {}
34 
35  virtual ~SettingInfo()
36  {
37  if( NULL != defaultValue_ )
38  {
39  delete defaultValue_;
40  }
41  }
42 
43  const Str& getName()
44  {
45  return name_;
46  }
47  const Str& getUriPart()
48  {
49  return uriPart_;
50  }
52  {
53  return defaultValue_;
54  }
55 
56 protected:
57  const Str name_;
58  const Str uriPart_;
60 
61 private:
62  // Note that the copy constructor below is private and not given a body.
63  // Any attempt to call it will return a compiler error.
64  SettingInfo( const SettingInfo& old ); // disallow copy constructor
65 };
66 
67 
68 
75 {
76 public:
77  static DefineBehavior* Instance( MissionNode* node, const Str& itemName, Logger& logger );
78 
79  virtual ~DefineBehavior();
80 
82  {
83  return settings_;
84  }
85 
86 
87 protected:
88 
89  friend class DefinedBehavior;
90 
92  DefineBehavior( const Str& name, ScriptAPI* scriptAPI );
93 
95 
97 
99 
102 
105 
108 
111 
114 
115 private:
116  // Note that the copy constructor below is private and not given a body.
117  // Any attempt to call it will return a compiler error.
118  DefineBehavior( const DefineBehavior& old ); // disallow copy constructor
119 };
120 
121 
128 {
129 public:
130  DefinedBehavior( const Str& prefix, DefineBehavior* definition );
131 
132  virtual ~DefinedBehavior();
133 
134  virtual void initialize();
135 
136  virtual void run();
137 
138  virtual void uninitialize();
139 
140  virtual bool isSatisfied();
141 
143  {
144  return settings_;
145  }
146 
148  {
149  return define_;
150  }
151 
152 protected:
153 
155 
157 
160 
163 
166 
169 
172 
175 
176 private:
177  // Note that the copy constructor below is private and not given a body.
178  // Any attempt to call it will return a compiler error.
179  DefinedBehavior( const DefinedBehavior& old ); // disallow copy constructor
180 };
181 
182 #endif /* DEFINEBEHAVIOR_H_ */
Client-side interface for injecting log data into the log queue.
Definition: Logger.h:30
Str name_
Definition: DefineBehavior.h:94
const Str name_
Definition: DefineBehavior.h:57
FlexArray< SettingInfo * > settings_
Definition: DefineBehavior.h:98
Information to create a Setting in a DefinedBehavior.
Definition: DefineBehavior.h:26
Method * uninitializeMethod_
initialize method;
Definition: DefineBehavior.h:168
Method * initializeMethod_
initialize method;
Definition: DefineBehavior.h:162
Abstract base class for scripted programming language interfaces.
Definition: ScriptAPI.h:29
virtual void initialize()
Provide a space for initialization before being run.
Definition: DefineBehavior.cpp:325
Information to create a DefinedBehavior that is embedded in scripted code within a mission file...
Definition: DefineBehavior.h:74
Behavior that is embedded in scripted code within a mission file.
Definition: DefineBehavior.h:127
virtual ~SettingInfo()
Definition: DefineBehavior.h:35
ScriptAPI * scriptAPI_
Definition: DefineBehavior.h:96
Method * isSatisfiedMethod_
satisfied method;
Definition: DefineBehavior.h:171
Behavior is the abstract base class for components that implement mission behaviors and commands...
Definition: Behavior.h:32
Method * runMethod_
run method;
Definition: DefineBehavior.h:165
DefineBehavior * getDefine()
Definition: DefineBehavior.h:147
A DataValue is an abstract base class for a data value and associated engineering units of the value...
Definition: DataValue.h:35
DataValue * defaultValue_
Definition: DefineBehavior.h:59
bool constructMethodRun_
true if the construtMethod_ has been run
Definition: DefineBehavior.h:174
MethodInfo * runMethod_
run method;
Definition: DefineBehavior.h:107
SettingInfo(const Str &name, const Str &uriPart, DataValue *defaultValue)
Definition: DefineBehavior.h:29
MethodInfo * uninitializeMethod_
initialize method;
Definition: DefineBehavior.h:110
DefineBehavior * define_
Definition: DefineBehavior.h:154
DefineBehavior(const Str &name, ScriptAPI *scriptAPI)
Protected constructor.
Definition: DefineBehavior.cpp:283
const Str & getUriPart()
Definition: DefineBehavior.h:47
const Str uriPart_
Definition: DefineBehavior.h:58
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
virtual ~DefinedBehavior()
DefinedBehavior ^.
Definition: DefineBehavior.cpp:300
Wraps a TiXmlNode.
Definition: MissionNode.h:20
Replacement for standard template class string.
Definition: Str.h:12
Wraps the inputs, outputs, and code for a method (i.e., initialize, run, etc) within a scripted compo...
Definition: Method.h:164
Definition: Method.h:110
FlexArray< SettingReader * > & getSettings()
Definition: DefineBehavior.h:142
MethodInfo * constructMethod_
construct method – called once, with no settings;
Definition: DefineBehavior.h:101
virtual ~DefineBehavior()
Definition: DefineBehavior.cpp:258
virtual void run()
The actual "payload" of the component.
Definition: DefineBehavior.cpp:353
DefinedBehavior(const Str &prefix, DefineBehavior *definition)
Definition: DefineBehavior.cpp:381
virtual void uninitialize()
Provide a space for uninitialization.
Definition: DefineBehavior.cpp:362
FlexArray< SettingReader * > settings_
Definition: DefineBehavior.h:156
Method * constructMethod_
construct method – called once, with no settings;
Definition: DefineBehavior.h:159
DataValue * getDataValue()
Definition: DefineBehavior.h:51
virtual bool isSatisfied()
Definition: DefineBehavior.cpp:371
static DefineBehavior * Instance(MissionNode *node, const Str &itemName, Logger &logger)
Definition: DefineBehavior.cpp:19
MethodInfo * isSatisfiedMethod_
satisfied method;
Definition: DefineBehavior.h:113
const Str & getName()
Definition: DefineBehavior.h:43
FlexArray< SettingInfo * > & getSettings()
Definition: DefineBehavior.h:81
MethodInfo * initializeMethod_
initialize method;
Definition: DefineBehavior.h:104