Free Electron
|
Layout namespace. More...
#include <Scope.h>
Public Member Functions | |
Scope (void) | |
Create a scope from within the fe::Registry. More... | |
Scope (Master &master) | |
Construct a Scope bound to the the TypeMaster and Allocator within master. More... | |
Scope (sp< Master > &spMaster) | |
Scope (sp< TypeMaster > spTypeMaster, sp< Allocator > allocator) | |
Construct a Scope bound to the given TypeMaster and Allocator. More... | |
Scope (const Scope &other) | |
Scope & | operator= (const Scope &other) |
virtual void | setName (const String &name) |
void | initialize (void) |
Post construction step (last chance to find Master) More... | |
void | layoutValidate (void) |
Validate that there are no dependency conflicts and remove dependency duplicates. More... | |
void | setLocking (BWORD a_locking) |
Specify if select methods should be protected with a mutex. More... | |
BWORD | isLocking (void) |
sp< Layout > | declare (const String &name) |
Declare a new layout. More... | |
sp< Layout > | lookupLayout (const String &name) |
Lock a layout. More... | |
void | registerFactory (String name, sp< RecordFactoryI > spRecordFactoryI) |
Specify who can produce a named layout. More... | |
Record | produceRecord (String name) |
Create and return a new Record from registered RecordFactoryI. More... | |
void | finalize (Record &rRecord) |
Run post-initialization on Record using registered RecordFactoryI. More... | |
Record | createRecord (sp< Layout > spLayout) |
Create and return a new Record of layout spLayout. More... | |
Record | createRecord (const String layout) |
sp< RecordArray > | createRecordArray (String layout, FE_UWORD count) |
Create and return a new RecordArray of layout spLayout. More... | |
sp< RecordArray > | createRecordArray (sp< Layout > spLayout, FE_UWORD count) |
sp< Attribute > | addDepend (sp< Depend > &depend) |
Free the given record. More... | |
FE_UWORD | getAttributeCount (void) const |
Return the total number of Attributes in this Scope. More... | |
sp< Attribute > & | findAttribute (const String &name, FE_UWORD &index) |
Return the Attribute with the given name. More... | |
sp< Attribute > & | findAttribute (const String &name) |
Return the Attribute with the given name. More... | |
sp< Attribute > | attribute (FE_UWORD index) |
Return the Attribute at the given index. More... | |
FE_UWORD | attributeIndex (sp< Attribute > spAttribute) |
Return the index of the given Attribute. More... | |
sp< Attribute > | support (const String &mayHave, const String &ofType) |
Add a support for a Attribute with name and type of name ofType. More... | |
bool | enforce (const String &ifHas, const String &mustHave) |
Enforce a Attribute dependency. More... | |
bool | enforce (const Array< String > &ifHas, const String &mustHave) |
bool | populate (const String &ifIs, const String &mustHave) |
Add a Attribute to a Layout. More... | |
bool | share (const String &ifIs, const String &share1, const String &share2) |
Clear all populate dependencies for Layout of name name. More... | |
void | clonePopulate (const String &ifThisHas, const String &thenThisDoes) |
sp< TypeMaster > | typeMaster (void) |
Return the associated TypeMaster. More... | |
Accessor< std::atomic< int > > & | refCount (void) |
Return an Accessor for the Record reference count Attribute. More... | |
void | resizeLayoutLocators (void) const |
void | peek (Peeker &peeker) |
For debugging. More... | |
U32 | serialIndex (void) |
template<typename R > | |
void | assignIDNumber (const R &record) |
template<typename R > | |
void | freeIDNumber (const R &r_old) |
FE_UWORD | getNextUniqueLayoutID (void) |
FE_UWORD | getNextUniqueIDR (void) |
void | addAccessorSet (AccessorSet *a_as) |
void | removeAccessorSet (AccessorSet *a_as) |
t_attributes & | attributes (void) |
Direct access to the attribute table. More... | |
t_layouts & | layouts (void) |
Direct access to the layout table. More... | |
t_depends & | depends (void) |
Direct access to the depend list. More... | |
sp< Allocator > | allocator (void) |
Direct access to the allocator. More... | |
sp< RecordCookbook > | cookbook (void) |
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) |
Private Types | |
typedef HashMap< String, sp< RecordFactoryI >, hash_string, eq_string > | StringRecordFactoryMap |
Private Member Functions | |
bool | shutdown (void) |
Release references to all Layout, Depend, and Store instances. More... | |
void | construct (sp< TypeMaster > spTypeMaster, sp< Allocator > allocator) |
void | prepareCookbook (sp< Master > &rspMaster) |
void | depAttributeCheck (sp< Depend > &depend) |
void | depRecordCheck (sp< Depend > &depend) |
sp< Attribute > | dynamicAddAttribute (const String &typeName, const String &attributeName) |
sp< Attribute > | addAttribute (const String &typeName, const String &attributeName) |
void | notifyLayoutsOfAttributeChange (sp< Depend > &depend) |
StringStringsMap & | factoryMultiMap (void) |
Private Attributes | |
sp< TypeMaster > | m_spTypeMaster |
t_layouts | m_layouts |
t_attributes | m_attributes |
t_indexmap | m_indexmap |
t_depends | m_depend |
sp< Allocator > | m_spAllocator |
sp< RecordCookbook > | m_spRecordCookbook |
std::set< AccessorSet * > | m_accessorSets |
bool | m_looking |
bool | m_locking |
I32 | m_serialCount |
U32 | m_serialIndex |
Accessor< std::atomic< int > > * | m_paCount |
Accessor< std::atomic< int > > * | m_paSerialNumber |
hp< Registry > | m_hpRegistry |
String | m_storeName |
StringRecordFactoryMap | m_factoryMap |
sp< Attribute > | m_nullAttribute |
FE_UWORD | m_nextUniqueLayoutID |
FE_UWORD | m_nextUniqueIDR |
Additional Inherited Members | |
Static Public Member Functions inherited from fe::Counted | |
static String | reportTracker (void) |
static U32 | trackerCount (void) |
Protected Types inherited from fe::Initialized | |
typedef void(* | InitializeFunction) (Initialized *) |
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) |
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... | |
Layout namespace.
Every Layout must be associated with a single Scope. Every Record layout is defined by a single Layout, therefore every Record is associated with a single Scope.
Scope is therefore the main class for state based activity. Records are defined (via Layout), created, and destroyed using Scope.
direct accessors | |||
:CT | |||
:CT | |||
:CT | |||
:CT | |||
:ID | |||
:ID | |||
:SN | |||
:SN | |||
:CT | |||
:SN |
fe::Scope::Scope | ( | void | ) |
Create a scope from within the fe::Registry.
This function will assert if called outside the registry which supplies the fe::Master information.
fe::Scope::Scope | ( | Master & | master | ) |
Construct a Scope bound to the the TypeMaster and Allocator within master.
fe::Scope::Scope | ( | sp< TypeMaster > | spTypeMaster, |
sp< Allocator > | allocator | ||
) |
Construct a Scope bound to the given TypeMaster and Allocator.
Free the given record.
This will throw an Exception if record is reference counted. All records with the Attribute FE_C are reference counted. This is the default for all records (Scope has populate("", FE_C) in its constructor). Add a dependency. This is mainly for internal use by support, enforce, populate, and share.
Referenced by enforce(), populate(), share(), and support().
|
inline |
Direct access to the allocator.
Use with care.
|
inline |
Direct access to the attribute table.
Use with care.
Create and return a new Record of layout spLayout.
Referenced by fe::ext::NullViewer::run().
sp< RecordArray > fe::Scope::createRecordArray | ( | String | layout, |
FE_UWORD | count | ||
) |
Create and return a new RecordArray of layout spLayout.
References lookupLayout().
Referenced by fe::ext::StratumDrawPoly::assignVisibility().
Declare a new layout.
This will create an empty and unlocked layout.
An empty layout name is not permitted (an invalid sp<> would be returned).
Referenced by fe::ext::NetworkCatalog::start().
|
inline |
Direct access to the depend list.
Use with care.
Enforce a Attribute dependency.
If a Layout has a Attribute named ifHas, it will also have a Attribute of name mustHave.
References addDepend().
void fe::Scope::finalize | ( | Record & | rRecord | ) |
Run post-initialization on Record using registered RecordFactoryI.
References fe::RecordSB::layout().
Return the Attribute with the given name.
The index of the Attribute is returned in index.
Referenced by findAttribute(), fe::BaseAccessor::initialize(), and fe::BaseAccessor::setup().
Return the Attribute with the given name.
References findAttribute().
FE_UWORD fe::Scope::getAttributeCount | ( | void | ) | const |
Return the total number of Attributes in this Scope.
Referenced by fe::RecordGroup::removeReferences().
void fe::Scope::initialize | ( | void | ) |
Post construction step (last chance to find Master)
References fe::hp< T >::isValid(), and fe::Component::registry().
|
inline |
Direct access to the layout table.
Use with care.
void fe::Scope::layoutValidate | ( | void | ) |
Validate that there are no dependency conflicts and remove dependency duplicates.
This is mainly for internal use.
Lock a layout.
Finalize the structure that the layout represents. This must happen before records of this layout are created. If not done before a call to createRecord or createRecordArray then the layout is automatically locked upon these calls. Return the layout with the given name
This first attempts to lookup an existing Layout. If that fails, it will then try to instantiate a layout from a RecordFactoryI registered under the same name.
If no layout is found, an invalid sp<> is returned.
Referenced by fe::ext::ObjectViewer::bind(), and createRecordArray().
void fe::Scope::peek | ( | Peeker & | peeker | ) |
For debugging.
Add a Attribute to a Layout.
If a Layout is named ifIs, then it will have a Attribute of name mustHave.
References addDepend().
Referenced by share().
Create and return a new Record from registered RecordFactoryI.
Accessor< std::atomic< int > > & fe::Scope::refCount | ( | void | ) |
void fe::Scope::registerFactory | ( | String | name, |
sp< RecordFactoryI > | spRecordFactoryI | ||
) |
Specify who can produce a named layout.
References fe::Component::name().
Referenced by fe::ext::RecordView::registerFactory().
|
inline |
Specify if select methods should be protected with a mutex.
Clear all populate dependencies for Layout of name name.
Specify a Attribute share. This means that two Attributes will actually be the same instance (same piece of memory) for a particular Layout. If a Layout is named ifIs, then treat Attributes of names share1 and share2 as the same.
References addDepend(), and populate().
|
private |
Add a support for a Attribute with name and type of name ofType.
References addDepend().
Referenced by fe::BaseAccessor::setup().
|
inline |
Return the associated TypeMaster.
Referenced by fe::RecordGroup::removeReferences().