Free Electron
|
Bindable collection of accessor Functors. More...
#include <RecordView.h>
Classes | |
class | Functor |
Bound accessor in a RecordView. More... | |
class | RecordHolder |
Untyped Functor base. More... | |
Public Member Functions | |
void | setName (const String &name) |
const String | verboseName (void) const |
void | bind (sp< Scope > &rspScope) |
Associate with a Scope. More... | |
void | bind (hp< Scope > &rhpScope) |
Associate with a Scope by Handle. More... | |
hp< Scope > & | scope (void) |
Return associated Scope. More... | |
void | unbind (void) |
Disassociate with any Record. More... | |
void | bind (const Record record, BWORD weak=FALSE) |
Associate with a specific Record. More... | |
void | bind (const WeakRecord weakRecord, BWORD weak=FALSE) |
Associate with a specific WeakRecord. More... | |
void | setWeakRecord (const WeakRecord weakRecord) |
Associate with a specific WeakRecord. More... | |
virtual void | produce (Record &rRecord) |
Produce a Record using all the attributes. More... | |
virtual void | finalize (Record &rRecord) |
Finalize a Record using all the attributes. More... | |
Record | createRecord (void) |
Create a Record using all the attributes. More... | |
WeakRecord | record (void) const |
Access the record by weak (fast) reference. More... | |
sp< Layout > | layout (void) |
Access a Layout of all the attributes. More... | |
void | dump (void) |
Spew attributes and state for the bound Record. More... | |
virtual void | addFunctors (void)=0 |
Called at instantiation to add functors. More... | |
virtual void | initializeRecord (void) |
Called at instantiation to initialize attributes. More... | |
virtual void | finalizeRecord (void) |
Called right after instantiation to finalize complex attributes. More... | |
void | setName (const String &name) |
const String | verboseName (void) const |
void | bind (sp< Scope > &rspScope) |
Associate with a Scope. More... | |
void | bind (hp< Scope > &rhpScope) |
Associate with a Scope by Handle. More... | |
hp< Scope > & | scope (void) |
Return associated Scope. More... | |
void | bind (const sp< RecordArray > &rspRecordArray) |
Associate with a specific RecordArray. More... | |
void | unbind (void) |
Disassociate with any Record or RecordArray. More... | |
void | bind (const Record record, BWORD weak=FALSE) |
Associate with a specific Record. More... | |
void | bind (const WeakRecord weakRecord, BWORD weak=FALSE) |
void | setIndex (U32 index) |
Set the index into the bound RecordArray. More... | |
BWORD | step (void) |
Step through the records in the array. More... | |
U32 | index (void) |
Return the current index into the RecordArray. More... | |
virtual void | produce (Record &rRecord) |
Produce a Record using all the attributes. More... | |
virtual void | finalize (Record &rRecord) |
Finalize a Record using all the attributes. More... | |
Record | createRecord (void) |
Create a Record using all the attributes. More... | |
WeakRecord | record (void) const |
Access the record by weak (fast) reference. More... | |
sp< Layout > | layout (void) |
Access a Layout of all the attributes. More... | |
void | dump (void) |
Spew attributes and state for the bound Record. More... | |
virtual void | addFunctors (void)=0 |
Called at instantiation to add functors. More... | |
virtual void | initializeRecord (void) |
Called at instantiation to initialize attributes. More... | |
virtual void | finalizeRecord (void) |
Called right after instantiation to finalize complex attributes. More... | |
Public Member Functions inherited from fe::AccessorSet | |
AccessorSet (sp< Scope > spScope) | |
virtual FE_UWORD | size (void) const |
virtual BaseAccessor * | operator[] (FE_UWORD index) |
bool | operator== (const AccessorSet &a_aset) const |
bool | operator< (const AccessorSet &a_aset) const |
bool | bind (const WeakRecord a_record) |
void | bind (sp< Scope > spScope) |
virtual void | populate (sp< Layout > spLayout) |
void | enforceHaving (const AccessorSet &a_other) |
bool | bindCheck (sp< Layout > spLayout) |
bool | check (sp< LayoutSB > spLayout) |
bool | check (sp< LayoutAV > spLayout) |
bool | bindCheck (sp< RecordArray > spRA) |
bool | check (sp< RecordArray > spRA) |
bool | check (const WeakRecord &a_record) |
bool | check (const Record &a_record) |
void | check (const WeakRecord a_record, const char *a_annotation) |
void | enforce (const String &a_ifHas) |
void | filter (sp< RecordGroup > rg_output, sp< RecordGroup > rg_input) |
hp< Scope > | scope (void) |
void | filter (std::vector< Record > &a_records, sp< RecordGroup > rg_input) |
void | filter (std::vector< WeakRecord > &a_records, sp< RecordGroup > rg_input) |
const t_bitset & | bitset (void) const |
void | setBitset (const t_bitset &a_bs) |
void | add (BaseAccessor &a_accessor, const String &a_attribute) |
void | add (BaseAccessor &a_accessor) |
void | attach (const WeakRecord &a_record) |
Public Member Functions inherited from fe::Component | |
const String & | name (void) const |
Return the components chosen name. More... | |
const String | verboseName (void) const |
Return the annotated chosen name. More... | |
void | setName (const String &name) |
Rename the component to anything you want. More... | |
hp< Registry > | registry (void) const |
Get the Registry that created this component. More... | |
void | adjoin (sp< Component > spComponent) |
Tie this component's lifetime to another. More... | |
sp< Component > | create (const String &implementation, BWORD quiet=FALSE) const |
Convienience function to registry()->create() More... | |
void | disjoin (void) |
Untie component from Hub, if connected. More... | |
String | factoryName (void) |
void | setLibrary (sp< Library > spLibrary) |
Store a reference to the library used to instantiate this component. More... | |
sp< Library > | library (void) |
Get the library that created the component. More... | |
void | setFactoryIndex (I32 a_factoryIndex) |
Set the library's factory index. More... | |
I32 | factoryIndex (void) |
Get the library's factory index. More... | |
void | setSingleton (BWORD set) |
Specify whether component is a singleton. More... | |
BWORD | isSingleton (void) |
Return whether component is a singleton. More... | |
virtual void | acquire (void) |
Specialized reference increment. More... | |
virtual void | release (void) |
Specialized reference decrement. More... | |
Public Member Functions inherited from fe::Handled< Component > | |
const hp< Component > & | getHandle (void) const |
Get a safe handle to this object. More... | |
Public Member Functions inherited from fe::Protectable | |
virtual I32 | protection (void) const |
virtual void | protect (void) |
virtual void | unprotect (void) |
virtual Protectable * | clone (Protectable *pInstance=NULL) |
Public Member Functions inherited from fe::Counted | |
virtual void | acquire (int &rCount) |
Increment the reference count (and get the count) More... | |
virtual void | abandon (void) |
Decrement the reference count. More... | |
int | count (void) const |
Return the count of references. More... | |
void | setName (const String &) |
void | trackReference (void *pReference, String what) |
void | untrackReference (void *pReference) |
void | registerRegion (void *pT, U32 bytes) |
Public Member Functions inherited from fe::Initialized | |
void | initializeAll (void) |
void | setActive (bool a_active) |
Static Public Member Functions | |
template<typename T > | |
static void | registerFactory (sp< Scope > spScope) |
Indicate a RecordFactoryI for a Scope. More... | |
static sp< RecordGroup > | loadRecordGroup (sp< Scope > spScope, String filename, BWORD a_binary=FALSE) |
Load a RecordGroup from a file. More... | |
static sp< RecordGroup > | loadRecordGroupFromBuffer (sp< Scope > spScope, String buffer, BWORD a_binary=FALSE) |
Serialize a RecordGroup from a string. More... | |
static void | saveRecordGroup (sp< Scope > spScope, sp< RecordGroup > &rspRecordGroup, String filename, BWORD a_binary=FALSE) |
Save a RecordGroup to a file. More... | |
template<typename T > | |
static void | registerFactory (sp< Scope > spScope) |
Indicate a RecordFactoryI for a Scope. More... | |
static sp< RecordGroup > | loadRecordGroup (sp< Scope > spScope, String filename, BWORD a_binary=FALSE) |
Load the root RecordGroup from a file. More... | |
static sp< RecordGroup > | loadRecordGroupFromBuffer (sp< Scope > spScope, String buffer, BWORD a_binary=FALSE) |
static void | saveRecordGroup (sp< Scope > spScope, sp< RecordGroup > &rspRecordGroup, String filename, BWORD a_binary=FALSE) |
Save the root RecordGroup to a file. More... | |
Static Public Member Functions inherited from fe::Counted | |
static String | reportTracker (void) |
static U32 | trackerCount (void) |
Public Attributes | |
Accessor< int > | count |
Protected Member Functions | |
void | add (BaseAccessor &rFunctor, const char *name) |
Add an attribute Functor. More... | |
RecordView (const RecordView &rRecordView) | |
void | add (BaseAccessor &rFunctor, const char *name) |
Add an attribute Functor. More... | |
Protected Member Functions inherited from fe::Handled< Component > | |
void | abandonHandle (void) |
Protected Member Functions inherited from fe::Counted | |
int | releaseInternal (void) |
Decrement the reference count. More... | |
void | suppressReport (void) |
Protected Member Functions inherited from fe::Initialized | |
void | addInitializer (InitializeFunction function) |
Private Member Functions | |
sp< Layout > | createLayout (void) |
String | nameOf (BaseAccessor &accessor) const |
String | typeOf (BaseAccessor &accessor) const |
String | printOf (BaseAccessor &accessor) |
sp< BaseType::Info > | helpOf (BaseAccessor &accessor) const |
sp< BaseType > | baseTypeOf (BaseAccessor &accessor) const |
RecordView (const RecordView &rRecordView) | |
void | assignIndex (U32 index) |
sp< Layout > | createLayout (void) |
String | nameOf (BaseAccessor &accessor) const |
String | typeOf (BaseAccessor &accessor) const |
String | printOf (BaseAccessor &accessor) |
sp< BaseType::Info > | helpOf (BaseAccessor &accessor) const |
sp< BaseType > | baseTypeOf (BaseAccessor &accessor) const |
Private Attributes | |
hp< Layout > | m_hpLayout |
Record | m_record |
WeakRecord | m_weakRecord |
sp< RecordArray > | m_spRecordArray |
U32 | m_index |
U32 | m_nextIndex |
BWORD | m_tempArray |
Additional Inherited Members | |
Protected Types inherited from fe::Initialized | |
typedef void(* | InitializeFunction) (Initialized *) |
Protected Attributes inherited from fe::AccessorSet | |
hp< Scope > | m_hpScope |
Array< BaseAccessor * > | m_accessors |
t_bitset | m_bitset |
WeakRecord | m_optional_record |
Related Functions inherited from fe::Component | |
FE_DL_EXPORT void FE_CDECL | checkUnload (sp< Library > &pLibrary, Component *pComponent=NULL) |
Delete the component and unload libraries where appropriate. More... | |
Bindable collection of accessor Functors.
RecordView is an enhanced AccessorSet that supports inheritance and default values. Like an AccessorSet, a RecordView instance can be reused for any number of Record instances.
For example:
A class that derives from RecordView is expected to provide several things. Added attributes are provided through Functors, an enhancement of the Accessor. Provide a name for the generated Layout by setting the name of the RecordView, using setName(). Functors are wired up using add() during addFunctors(). The implementation of addFunctors() should call the like-named functions for any direct base classes, much like a manual constructor mechanism. Convention insists that attributes names are provided using FE_USE or FE_SPEC. FE_USE presumes that an FE_SPEC or FE_ATTRIBUTE elsewhere has provided a description for the atrribute. As a RecordFactoryI, a RecordView can be used to instantiate Records by name from file. The method initializeRecord is called before loading data to provide basic defaults. A method finalizeRecord can be used after loading a Record for producing derived values, such as creating a component as named by an attribute. Both initializeRecord and finalizeRecord may be omitted if nothing needs to be done for that stage. As with addFunctors, both initializeRecord and finalizeRecord should call the like-named functions for any direct base classes. To be available as a RecordFactoryI, each RecordView-derived type should be added to a library during CreateLibrary() like any other Component.
File-based defaults can be provided as a template in a record group file.
Attributes not represented by a template retain settings from initializeRecord or their type's constructor. Derived templates can provide new defaults that override prior values. In the basic case, templates will parallel provided Factories, including multiple inheritance (the second argument to TEMPLATE). However, new templates can be provided purely on multiple inheritance where no new attributes are added.
|
inlineprotected |
Add an attribute Functor.
The functor should be a member variable. The name can be arbitrary, but conventions may be wise.
References fe::BaseAccessor::setup().
|
inlineprotected |
Add an attribute Functor.
The functor should be a member variable. The name can be arbitrary, but conventions may be wise.
References index(), and fe::BaseAccessor::setup().
|
pure virtual |
Called at instantiation to add functors.
In addition to using add() to explicitly adding all the functors for a particular class, the implementation of this function should first call addFunctors() for all directly inherited classes that are indirectly or directly derived from RecordView().
Implemented in fe::ext::WindowEvent, fe::ext::StickLevel, fe::ext::Plant, fe::ext::Forest, fe::ext::TreeLevel, fe::ext::Audible, fe::ext::Sphere, fe::ext::Material, fe::ext::TreeSeed, fe::ext::Matter, fe::ext::Scanner, fe::ext::SurfaceModel, fe::ext::Executor, fe::ext::Cylinder, fe::ext::Arena, fe::ext::Operator, fe::ext::Recordable, fe::ext::SurfacePoint, fe::ext::ControlCenter, fe::ext::Observation, fe::ext::SurfacePrimitive, fe::ext::SurfaceTransform, fe::ext::Particle, fe::ext::Theater, fe::ext::Strata, fe::ext::Stratum, fe::ext::Raster, fe::ext::Rod, fe::ext::Disk, fe::ext::SurfaceFile, fe::ext::PlantSeed, fe::ext::Radio, fe::ext::Behavior, fe::ext::Cannon, fe::ext::Controlled, fe::ext::Crowd, fe::ext::Foundry, fe::ext::Mortal, fe::ext::Periodic, fe::ext::Surveillance, fe::ext::Explosion, fe::ext::Attractor, fe::ext::Targeter, fe::ext::Thruster, fe::ext::LeafLevel, and fe::ext::Proxy.
|
pure virtual |
Called at instantiation to add functors.
In addition to using add() to explicitly adding all the functors for a particular class, the implementation of this function should first call addFunctors() for all directly inherited classes that are indirectly or directly derived from RecordView().
Implemented in fe::ext::WindowEvent, fe::ext::StickLevel, fe::ext::Plant, fe::ext::Forest, fe::ext::TreeLevel, fe::ext::Audible, fe::ext::Sphere, fe::ext::Material, fe::ext::TreeSeed, fe::ext::Matter, fe::ext::Scanner, fe::ext::SurfaceModel, fe::ext::Executor, fe::ext::Cylinder, fe::ext::Arena, fe::ext::Operator, fe::ext::Recordable, fe::ext::SurfacePoint, fe::ext::ControlCenter, fe::ext::Observation, fe::ext::SurfacePrimitive, fe::ext::SurfaceTransform, fe::ext::Particle, fe::ext::Theater, fe::ext::Strata, fe::ext::Stratum, fe::ext::Raster, fe::ext::Rod, fe::ext::Disk, fe::ext::SurfaceFile, fe::ext::PlantSeed, fe::ext::Radio, fe::ext::Behavior, fe::ext::Cannon, fe::ext::Controlled, fe::ext::Crowd, fe::ext::Foundry, fe::ext::Mortal, fe::ext::Periodic, fe::ext::Surveillance, fe::ext::Explosion, fe::ext::Attractor, fe::ext::Targeter, fe::ext::Thruster, fe::ext::LeafLevel, and fe::ext::Proxy.
Associate with a Scope.
This can happen automatically by binding to a Record, but may be neccessary if you need to use the Functors before an appropriate Layout exists.
Implements fe::RecordFactoryI.
Referenced by fe::ext::Attractor::initializeRecord(), fe::ext::Crowd::initializeRecord(), fe::ext::Foundry::initializeRecord(), and fe::ext::Scanner::initializeRecord().
|
inline |
Associate with a specific Record.
The Record will persist while bound. Use unbind() to release the binding.
Passing Record objects is not thread-safe.
This may use the Record's scope to initialize the functors.
Associate with a Scope.
This can happen automatically by binding to a Record or RecordArray, but may be neccessary if you need to use the Functors before an appropriate Layout exists.
Implements fe::RecordFactoryI.
|
inline |
Associate with a specific WeakRecord.
The RecordView will not ensure that the WeakRecord continues to persist.
This may use the Record's scope to initialize the functors.
|
inline |
Associate with a specific RecordArray.
Use setIndex() or step() to associate with each Record.
|
inline |
Associate with a specific Record.
This is only intended to be used when there is no containing RecordArray available. It can be more efficient to bind to a RecordArray and use setIndex() or step().
Passing Record objects is not thread-safe.
|
inline |
Create a Record using all the attributes.
The Record is automatically bound.
Referenced by produce().
|
inline |
Create a Record using all the attributes.
The Record is automatically bound.
|
inline |
Spew attributes and state for the bound Record.
|
inline |
Spew attributes and state for the bound Record.
|
inlinevirtual |
Finalize a Record using all the attributes.
This step follows after the record is fully initialized and potentially serialized in.
The Record is unbound after initialization.
Implements fe::RecordFactoryI.
References finalizeRecord(), fe::RecordSB::isValid(), and unbind().
|
inlinevirtual |
Finalize a Record using all the attributes.
This step follows after the record is fully initialized and potentially serialized in.
The Record is unbound after initialization.
Implements fe::RecordFactoryI.
References finalizeRecord(), fe::RecordSB::isValid(), and unbind().
|
inlinevirtual |
Called right after instantiation to finalize complex attributes.
In addition to adjusting any attributes, the implementation of this function should first call finalizeRecord() for all directly inherited classes that are indirectly or directly derived from RecordView().
Functors can be used as accessors at this point.
Reimplemented in fe::ext::SurfaceModel, fe::ext::Material, fe::ext::Executor, fe::ext::SurfacePrimitive, fe::ext::Recordable, and fe::ext::Strata.
Referenced by finalize(), fe::ext::Strata::finalizeRecord(), and fe::ext::Recordable::finalizeRecord().
|
inlinevirtual |
Called right after instantiation to finalize complex attributes.
In addition to adjusting any attributes, the implementation of this function should first call finalizeRecord() for all directly inherited classes that are indirectly or directly derived from RecordView().
Functors can be used as accessors at this point.
Reimplemented in fe::ext::SurfaceModel, fe::ext::Material, fe::ext::Executor, fe::ext::SurfacePrimitive, fe::ext::Recordable, and fe::ext::Strata.
|
inline |
Return the current index into the RecordArray.
Referenced by add(), and setIndex().
|
inlinevirtual |
Called at instantiation to initialize attributes.
In addition to setting any attributes, the implementation of this function should first call initializeRecord() for all directly inherited classes that are indirectly or directly derived from RecordView().
Functors can be used as accessors at this point.
Reimplemented in fe::ext::WindowEvent, fe::ext::StickLevel, fe::ext::Forest, fe::ext::Plant, fe::ext::Scanner, fe::ext::Audible, fe::ext::SurfaceTransform, fe::ext::SurfaceModel, fe::ext::TreeLevel, fe::ext::Matter, fe::ext::Arena, fe::ext::ControlCenter, fe::ext::Theater, fe::ext::TreeSeed, fe::ext::Executor, fe::ext::Stratum, fe::ext::Particle, fe::ext::Material, fe::ext::Sphere, fe::ext::Observation, fe::ext::Cylinder, fe::ext::SurfacePoint, fe::ext::SurfacePrimitive, fe::ext::Raster, fe::ext::Rod, fe::ext::Cannon, fe::ext::Operator, fe::ext::Foundry, fe::ext::Radio, fe::ext::Recordable, fe::ext::Behavior, fe::ext::Controlled, fe::ext::Crowd, fe::ext::Mortal, fe::ext::Strata, fe::ext::Periodic, fe::ext::Attractor, fe::ext::Surveillance, fe::ext::Targeter, fe::ext::Thruster, fe::ext::Disk, fe::ext::Explosion, fe::ext::SurfaceFile, fe::ext::PlantSeed, fe::ext::Proxy, and fe::ext::LeafLevel.
Referenced by fe::ext::SurfaceFile::initializeRecord(), fe::ext::Recordable::initializeRecord(), fe::ext::Strata::initializeRecord(), and produce().
|
inlinevirtual |
Called at instantiation to initialize attributes.
In addition to setting any attributes, the implementation of this function should first call initializeRecord() for all directly inherited classes that are indirectly or directly derived from RecordView().
Functors can be used as accessors at this point.
Reimplemented in fe::ext::WindowEvent, fe::ext::StickLevel, fe::ext::Forest, fe::ext::Plant, fe::ext::Scanner, fe::ext::Audible, fe::ext::SurfaceTransform, fe::ext::SurfaceModel, fe::ext::TreeLevel, fe::ext::Matter, fe::ext::Arena, fe::ext::ControlCenter, fe::ext::Theater, fe::ext::TreeSeed, fe::ext::Executor, fe::ext::Stratum, fe::ext::Particle, fe::ext::Material, fe::ext::Sphere, fe::ext::Observation, fe::ext::Cylinder, fe::ext::SurfacePoint, fe::ext::SurfacePrimitive, fe::ext::Raster, fe::ext::Rod, fe::ext::Cannon, fe::ext::Operator, fe::ext::Foundry, fe::ext::Radio, fe::ext::Recordable, fe::ext::Behavior, fe::ext::Controlled, fe::ext::Crowd, fe::ext::Mortal, fe::ext::Strata, fe::ext::Periodic, fe::ext::Attractor, fe::ext::Surveillance, fe::ext::Targeter, fe::ext::Thruster, fe::ext::Disk, fe::ext::Explosion, fe::ext::SurfaceFile, fe::ext::PlantSeed, fe::ext::Proxy, and fe::ext::LeafLevel.
|
inlinevirtual |
Access a Layout of all the attributes.
Implements fe::RecordFactoryI.
|
inlinevirtual |
Access a Layout of all the attributes.
Implements fe::RecordFactoryI.
|
inlinestatic |
Load a RecordGroup from a file.
This is a convenience that doesn't really relate to RecordView.
|
inlinestatic |
Load the root RecordGroup from a file.
This is a convenience that doesn't really relate to RecordView.
|
inlinestatic |
Serialize a RecordGroup from a string.
This is a convenience that doesn't really relate to RecordView.
|
inlinevirtual |
Produce a Record using all the attributes.
The Record is unbound after initialization.
Implements fe::RecordFactoryI.
References createRecord(), initializeRecord(), fe::RecordSB::isValid(), and unbind().
|
inlinevirtual |
Produce a Record using all the attributes.
The Record is unbound after initialization.
Implements fe::RecordFactoryI.
References createRecord(), initializeRecord(), fe::RecordSB::isValid(), and unbind().
|
inline |
Access the record by weak (fast) reference.
Referenced by fe::ext::RecordView::Functor< T >::call().
|
inline |
Access the record by weak (fast) reference.
|
inlinestatic |
Indicate a RecordFactoryI for a Scope.
The template type is presumably a RecordView. This function extracts the relevant arguments to pass to the Scope.
It is usually preferable to add the RecordView as a Scope-generic RecordFactoryI using the general registry mechanism.
This is a convenience that doesn't really relate to RecordView.
References fe::Scope::registerFactory().
|
inlinestatic |
Indicate a RecordFactoryI for a Scope.
The template type is presumably a RecordView. This function extracts the relevant arguments to pass to the Scope.
It is usually preferable to add the RecordView as a Scope-generic RecordFactoryI using the general registry mechanism.
This is a convenience that doesn't really relate to RecordView.
References fe::Scope::registerFactory().
|
inlinestatic |
Save a RecordGroup to a file.
This is a convenience that doesn't really relate to RecordView.
|
inlinestatic |
Save the root RecordGroup to a file.
This is a convenience that doesn't really relate to RecordView.
|
inline |
Set the index into the bound RecordArray.
The first step() after setIndex() does not increment the index.
References index().
|
inline |
Associate with a specific WeakRecord.
The RecordView will not ensure that the WeakRecord continues to persist.
This method is faster than bind(WeakRecord) as it will never check the Scope and initialize the functors. Using bind(sp<Scope>) before this method can ensure that the functors are initialized.
Referenced by fe::ext::RecordArrayView< fe::ext::Matter >::at().
|
inline |
Step through the records in the array.
The first step will stay on the first record. Later steps increment the index. Stepping past the last record will return FALSE.
In the future, filters may allow step() to skip records.
|
inline |
Disassociate with any Record.
This should free all references.
Referenced by finalize(), and produce().
|
inline |
Disassociate with any Record or RecordArray.
This should free all references.