80 time_stamp( _time_stamp ) {
93 if( event_time <= last_event_time ) {
95 Console(LogLevel::Debug) <<
"Field: New event has same timestamp as last generated event, incrementing timestamp" << std::endl;
98 unsigned long long* temp =
reinterpret_cast<unsigned long long*
>(&last_event_time);
100 event_time = last_event_time;
102 last_event_time = event_time;
122 virtual void checkFieldType(
Field *f,
int index );
125 void setName(
string _name ) { name = _name; }
132 string getFullName();
138 virtual X3DTypes::X3DType
getX3DType() {
return X3DTypes::UNKNOWN_X3D_TYPE; }
146 virtual void route(
Field*,
int id = 0 );
150 virtual void routeNoEvent(
Field*,
int id = 0 );
153 virtual void unroute(
Field* );
157 virtual Field *replaceRoute(
Field* f,
unsigned int i,
int id = 0 );
161 virtual Field *replaceRouteNoEvent(
Field* f,
unsigned int i,
int id = 0 );
166 inline void route( H3DUniquePtr< F > &f,
int id = 0 ) {
167 route( f.get(),
id ); }
173 routeNoEvent( f.get(),
id );
183 while( routes_out.begin() != routes_out.end() ) {
184 unroute( *routes_out.begin() );
190 virtual void upToDate();
195 return event.ptr == NULL;
199 virtual void touch();
207 void setOwner(
Node *n );
211 access_type = _access_type;
219 typedef vector< Field * > FieldSet;
220 typedef vector< Field * > FieldVector;
225 for( FieldSet::const_iterator i = routes_out.begin();
226 i != routes_out.end(); ++i ) {
227 if( (*i) == f )
return true;
235 for( FieldVector::const_iterator i = routes_in.begin();
236 i != routes_in.end(); ++i ) {
237 if( (*i) == f )
return true;
260 access_check_on = on;
265 return access_check_on;
272 virtual void startEvent();
275 virtual void propagateEvent( Event e );
278 virtual void routeFrom(
Field*,
int id );
281 virtual void unrouteFrom(
Field* );
284 virtual Field *replaceRouteFrom(
Field* f,
unsigned int i,
int id );
293 void checkAccessTypeRoute(
Field *f,
int id );
298 void checkAccessTypeRouteFrom(
Field *f,
int id );
302 void checkAccessTypeGet(
int id );
306 void checkAccessTypeSet(
int id );
342 return is_program_setting;
348 is_program_setting = used_as_setting;
351 bool is_program_setting;
Base header file that handles all configuration related settings.
Include this file to include the H3D specific types.
Header file containing all X3D types enumerated.
Exception thrown when performing actions that conflict with the field's access type.
Definition: Field.h:50
The Field class.
Definition: Field.h:46
void markProgramSetting(bool used_as_setting)
Set it this field is used by program settings fields in scene or not.
Definition: Field.h:347
bool isProgramSetting()
Returns true if this field is part of program settings fields.
Definition: Field.h:341
void unrouteAll()
Remove all the routes from this field.
Definition: Field.h:182
const FieldSet & getRoutesOut()
Get the Fields this Field is routed to.
Definition: Field.h:248
virtual X3DTypes::X3DType getX3DType()
Returns the X3DType of the field.
Definition: Field.h:138
Node * owner
The node that contain this field.
Definition: Field.h:330
void setName(string _name)
Sets local the name of the field. Will be used in error reporting.
Definition: Field.h:125
const Event & getLatestEvent()
Get the latest event.
Definition: Field.h:253
bool isUpToDate()
Returns true if the field is up to date, i.e.
Definition: Field.h:194
bool access_check_on
If true, access type checks will be done when getting/setting values and setting up routes.
Definition: Field.h:335
AccessType
The different access types that a field can have.
Definition: Field.h:53
@ INPUT_ONLY
The value of the field can only set, not read.
Definition: Field.h:67
@ INITIALIZE_ONLY
The value of the field can only be changed before the Node that is the owner of the field has been in...
Definition: Field.h:57
@ OUTPUT_ONLY
The value of the field can only read, not set.
Definition: Field.h:62
void setAccessCheck(bool on)
Set access type checking on or off.
Definition: Field.h:259
Event event
The last event that happened.
Definition: Field.h:327
void setAccessType(AccessType _access_type)
Set the access type of the field.
Definition: Field.h:210
bool hasRouteFrom(Field *f)
Returns true if the field given as argument is routed to this field.
Definition: Field.h:234
bool event_lock
If true, stops events from being propagated.
Definition: Field.h:316
static string classTypeName()
Returns a string name for this field type.
Definition: Field.h:142
FieldVector routes_in
The Field that are routed to this field.
Definition: Field.h:325
bool isAccessCheckOn()
Returns true if checking of access types is on.
Definition: Field.h:264
void routeNoEvent(H3DUniquePtr< F > &f, int id=0)
Set up a route from this field to the field residing in the H3DUniquePtr given as argument.
Definition: Field.h:172
bool routesTo(Field *f)
Returns true if this field is routed to the field given as argument.
Definition: Field.h:224
bool update_lock
If true, stops the update() function from being called in the upToDate() function.
Definition: Field.h:320
void unroute(H3DUniquePtr< F > &f)
Remove the route from this field to the field residing in the H3DUniquePtr given as argument.
Definition: Field.h:179
void route(H3DUniquePtr< F > &f, int id=0)
Set up a route from this field to the field residing in the H3DUniquePtr given as argument.
Definition: Field.h:166
AccessType access_type
The type of access to the field.
Definition: Field.h:332
AccessType getAccessType()
Get the access type of the field.
Definition: Field.h:215
const FieldVector & getRoutesIn()
Get the Fields that are routed to this Field.
Definition: Field.h:243
virtual void update()
This function will be called to update the field if it has a pending event when the upToDate() functi...
Definition: Field.h:288
virtual string getTypeName()
Returns a string name for this field type.
Definition: Field.h:135
FieldSet routes_out
The Fields that this field is routed to.
Definition: Field.h:323
Node * getOwner()
Get the Node that contains this field.
Definition: Field.h:202
string name
The name of the field.
Definition: Field.h:312
Node is the base class for all classes that can be part of the H3D scene-graph.
Definition: Node.h:46
This is a field which value can be set by a string from the X3D parser.
Definition: Field.h:356
virtual void setValueFromString(const string &s)=0
Set the value of the field given a string.
virtual string getValueAsString(const string &=" ")
Get the value of the field as a string.
Definition: Field.h:364
This is a field which value can be set by a string from the X3D parser.
Definition: Field.h:371
virtual void addElementFromString(const string &s)=0
Add a new element to an MField from a string value.
virtual string getElementAsString(size_t)
Get the value of an element of the field as a string.
Definition: Field.h:378
virtual size_t getSize()=0
Set the value of the field given a string.
The Scene node is topmost node that takes care of the rendering of the scene graph both haptically an...
Definition: Scene.h:56
H3D_API_EXCEPTION(Vec2dNormalizeError)
H3D API namespace.
Definition: Anchor.h:38
FieldDBTemplate< N, F > * INPUT_OUTPUT(H3DNodeDatabase *_container, const std::string &_name, H3DUniquePtr< F > N::*_ptr)
Specialization to handle case where access type is INPUT_OUTPUT.
Definition: H3DNodeDatabase.h:178
The Event struct encapsulates an event in the field network.
Definition: Field.h:75
static H3DTime generateEventTime()
Provides a value which is guaranteed to be unique (unlike TimeStamp()) and always increasing.
Definition: Field.h:91
Field * ptr
The Field that caused the event.
Definition: Field.h:84
TimeStamp time_stamp
The time of the event.
Definition: Field.h:87
static H3DTime last_event_time
Last used globally unique time.
Definition: Field.h:109
Event(Field *_ptr, const TimeStamp &_time_stamp)
Constructor.
Definition: Field.h:78