DigitalSpaces::DIScheduledObject Struct Reference
[Core]

#include <Interfaces.h>

Inherits DigitalSpaces::DIObjectBase.


Detailed Description

Interface for an object to be scheduled and called by the Core.

This is the main interface provided by "Factory" objects. This is exported from all components GetComponentInfo function, which is called by the Core after loading a component.

Todo:
Give consideration to changing the system, so that rather then GetComponentInfo returning a structure that contains DIScheduledObject, the DICore supports being given a DIScheduledObject, at any point in time. This would allow the use of the scheduler in more situations, in a more flexible arrangement.
Todo:
Also under consideration is changing the GetMaxRunInterval/GetMinRunInterval system to something where the Core asks the DIScheduledObject to decrease or increase it's load on the system, and it's up to the component implementation if this involves changing its call frequency. This would additionally allow the component to know when to enact Level Of Detail changes, and such.

Public Member Functions

float PerformPrivateStartupStep ()
 Instructs the implementation to perform any initialization work that doesn't involve interaction with any other components.
float PerformPublicStartupStep ()
 Instructs the implementation to perform initialization work, while allowing access to other components.
bool PerformHeartbeat (float fDeltaTime, float fDeltaRealTime)
 The main work function of an implementation, this is called periodically by the Core.
void StopFactory ()
 Instructs the implementation to perform cleanup, in preperation for being unloaded.
unsigned long GetMaxRunInterval ()
 Returns the maximum number of heartbeats (10ms) that should occur between calls to PerformHeartbeat.
unsigned long GetMinRunInterval ()
 Returns the minimum number of heartbeats (10ms) that should occure between calls to PerformHeartbeat.
const char * GetDescriptiveName ()
 Returns a human readable descriptive name of the implementation, for use in logging and debug output.

Member Function Documentation

float DigitalSpaces::DIScheduledObject::PerformPrivateStartupStep (  ) 

Instructs the implementation to perform any initialization work that doesn't involve interaction with any other components.

At this point of initialization, all attempts to find interfaces (GetFactoriesWithInterface) to other factories will return nothing, UNLESS you are requesting an interface implemented by the Core (which is currently DICore1 and DIFileSystemBrowser).

Returns:
A value between 0.0 and 1.0 indicates there is more work to be done, and the function should be called again. A value of 1.0 or larger indicates that all initialization is complete. A value less then 0.0 indicates an error, and the Core should abort loading.
Note:
Even after returning a value of 1.0, this function may be called again.

float DigitalSpaces::DIScheduledObject::PerformPublicStartupStep (  ) 

Instructs the implementation to perform initialization work, while allowing access to other components.

The implementation should be aware that as well as having access to other components, other components will have access to this implementation, and should be ready to service any calls. Additionally, the implementation cannot be certain of the order components will be called in, so this implementation may be called from another implementation's PerformPublicStartupStep, without this implementations PerformPublicStartupStep having been called.

Returns:
A value between 0.0 and 1.0 indicates there is more work to be done, and the function should be called again. A value of 1.0 or larger indicates that all initialization is complete. A value less then 0.0 indicates an error, and the Core should abort loading.
Note:
Even after returning a value of 1.0, this function may be called again.

bool DigitalSpaces::DIScheduledObject::PerformHeartbeat ( float  fDeltaTime,
float  fDeltaRealTime 
)

The main work function of an implementation, this is called periodically by the Core.

This is called based on a variable interval between the values supplied by GetMaxRunInterval and GetMinRunInterval.

Parameters:
fDeltaTime The amount of simulated time that has passed since this function was last called for this implementation. Ideally this should match real time, but if the simulation/systemn is under load, it will not. However, it will be consistant, and should be taken as if it was accurate.
fDeltaRealTime The amount of real time that has passed since this function was lass called for this implementation.
Returns:
False indicates an error occured and the Core should stop running the simulation.

void DigitalSpaces::DIScheduledObject::StopFactory (  ) 

Instructs the implementation to perform cleanup, in preperation for being unloaded.

unsigned long DigitalSpaces::DIScheduledObject::GetMaxRunInterval (  ) 

Returns the maximum number of heartbeats (10ms) that should occur between calls to PerformHeartbeat.

For the implementation to be called every heartbeat, this should return 1. If your component only needs to perform calculations every second, it should return the value 100. If the implementation wants to be called at every opportunity, it should return 0.

unsigned long DigitalSpaces::DIScheduledObject::GetMinRunInterval (  ) 

Returns the minimum number of heartbeats (10ms) that should occure between calls to PerformHeartbeat.

This allows an implementation to specify the maximum load this component will apply to the system. If your component only needs to perform calculations every second, it should return the value 100. If the implementation wants to be called at every opportunity, it should return 0.

const char* DigitalSpaces::DIScheduledObject::GetDescriptiveName (  ) 

Returns a human readable descriptive name of the implementation, for use in logging and debug output.


The documentation for this struct was generated from the following file:

Generated on Fri Aug 22 18:12:10 2008 for Digital Spaces by  doxygen 1.5.6