Free Electron
Classes | Public Member Functions | Private Member Functions | Private Attributes | Related Functions | List of all members
fe::Component Class Reference

Base for all interfacable components. More...

#include <Component.h>

Inherits fe::Handled< Component >, fe::CastableAs< Component >, and fe::Initialized.

Inherited by beacon::BeaconClientI [virtual], beacon::BeaconServerI [virtual], beacon::BeaconTimeSyncI [virtual], DerivedComponent_A [virtual], DerivedComponent_C [virtual], fe::Catalog [virtual], fe::CatalogReaderI [virtual], fe::CatalogWriterI [virtual], fe::data::FileStreamI, fe::data::StreamI, fe::ext::ApplicationI [virtual], fe::ext::ApplicationWindowI [virtual], fe::ext::AudioI [virtual], fe::ext::BroadPhaseI [virtual], fe::ext::CameraControllerI [virtual], fe::ext::CameraI [virtual], fe::ext::ChunkReceiver, fe::ext::ChunkSender, fe::ext::ClientI [virtual], fe::ext::ConfigI [virtual], fe::ext::ConnectionI [virtual], fe::ext::ConnectionI [virtual], fe::ext::ContextODE [virtual], fe::ext::ContextOSG [virtual], fe::ext::ContextSDL [virtual], fe::ext::DensityFieldI [virtual], fe::ext::DirectorI [virtual], fe::ext::DispatchI [virtual], fe::ext::DrawableI [virtual], fe::ext::DrawBufferI [virtual], fe::ext::DrawI [virtual], fe::ext::DrawOpenGL::Texture [virtual], fe::ext::DrivelineI [virtual], fe::ext::EvaluatorI [virtual], fe::ext::EventContextI [virtual], fe::ext::EventMapI [virtual], fe::ext::FilterI [virtual], fe::ext::FlightMissionI [virtual], fe::ext::FontI [virtual], fe::ext::ForkI [virtual], fe::ext::FunctionI [virtual], fe::ext::GroundI [virtual], fe::ext::HandlerI [virtual], fe::ext::ImageI [virtual], fe::ext::IntegerI [virtual], fe::ext::IntersectPointI [virtual], fe::ext::IntersectRayI [virtual], fe::ext::IntersectRectI [virtual], fe::ext::JsonValue, fe::ext::Listener, fe::ext::ListenerI [virtual], fe::ext::LuaI [virtual], fe::ext::MaskI [virtual], fe::ext::MaskMapI [virtual], fe::ext::MassI [virtual], fe::ext::MessageI [virtual], fe::ext::MessageReliableUDPI [virtual], fe::ext::OperatorGraphI, fe::ext::OrchestratorI [virtual], fe::ext::Oscilloscope, fe::ext::PaletteI [virtual], fe::ext::ParserI [virtual], fe::ext::PipelineI [virtual], fe::ext::PlantModelI [virtual], fe::ext::PointI [virtual], fe::ext::ProxI [virtual], fe::ext::QuickViewerI [virtual], fe::ext::RampI [virtual], fe::ext::ReactorI [virtual], fe::ext::RealI [virtual], fe::ext::RecordableI [virtual], fe::ext::RecordArrayView< T > [virtual], fe::ext::RecorderI [virtual], fe::ext::RecordI [virtual], fe::ext::ScalarFieldI [virtual], fe::ext::ScalarShaderI [virtual], fe::ext::SceneNodeI [virtual], fe::ext::SequencerI [virtual], fe::ext::ServerI, fe::ext::ShaderI [virtual], fe::ext::ShaderVariablesI [virtual], fe::ext::SignalerI [virtual], fe::ext::SketchI [virtual], fe::ext::SpaceI [virtual], fe::ext::SparseMatrix1< T >, fe::ext::SparseMatrix2x2< T >, fe::ext::SparseMatrix3x3< T >, fe::ext::SpatialTreeI [virtual], fe::ext::SplatterI [virtual], fe::ext::Spool< T >, fe::ext::StateBindI [virtual], fe::ext::StrataI [virtual], fe::ext::StratumDrawI [virtual], fe::ext::StratumI [virtual], fe::ext::StreamableI [virtual], fe::ext::StringFilterI, fe::ext::StringI [virtual], fe::ext::SurfaceAccessibleAbc::FileContext, fe::ext::SurfaceAccessibleFbx::FileContext, fe::ext::SurfaceAccessibleI [virtual], fe::ext::SurfaceAccessorI [virtual], fe::ext::SurfaceI [virtual], fe::ext::SurfaceI::ImpactI [virtual], fe::ext::SystemI [virtual], fe::ext::Terminal, fe::ext::TireI [virtual], fe::ext::TypeNative, fe::ext::VectorFieldI [virtual], fe::ext::ViewerI [virtual], fe::ext::ViewI [virtual], fe::ext::VoiceI [virtual], fe::ext::WindowI [virtual], fe::ext::WorkForceI [virtual], fe::ext::WorkI [virtual], fe::ext::YamlNode, fe::Layout, fe::ManifestReaderI [virtual], fe::MethodI [virtual], fe::PopulateI [virtual], fe::RecordCookbook, fe::RecordFactoryI [virtual], fe::Scope, fe::StateCatalog::ListenerI [virtual], fe::StepCostI [virtual], fe::StoreI [virtual], fe::StringScanI [virtual], fe::WatcherI [virtual], MyComponent2I [virtual], MyComponentI [virtual], fe::ext::RecordArrayView< fe::ext::Attractor > [virtual], fe::ext::RecordArrayView< fe::ext::Audible > [virtual], fe::ext::RecordArrayView< fe::ext::Behavior > [virtual], fe::ext::RecordArrayView< fe::ext::Cannon > [virtual], fe::ext::RecordArrayView< fe::ext::ControlCenter > [virtual], fe::ext::RecordArrayView< fe::ext::Explosion > [virtual], fe::ext::RecordArrayView< fe::ext::Foundry > [virtual], fe::ext::RecordArrayView< fe::ext::Matter > [virtual], fe::ext::RecordArrayView< fe::ext::Mortal > [virtual], fe::ext::RecordArrayView< fe::ext::Particle > [virtual], fe::ext::RecordArrayView< fe::ext::Periodic > [virtual], fe::ext::RecordArrayView< fe::ext::Plant > [virtual], fe::ext::RecordArrayView< fe::ext::Radio > [virtual], fe::ext::RecordArrayView< fe::ext::Rod > [virtual], fe::ext::RecordArrayView< fe::ext::Scanner > [virtual], fe::ext::RecordArrayView< fe::ext::Sphere > [virtual], fe::ext::RecordArrayView< fe::ext::SurfacePoint > [virtual], fe::ext::RecordArrayView< fe::ext::Targeter > [virtual], fe::ext::RecordArrayView< fe::ext::Thruster > [virtual], fe::ext::RecordArrayView< SurfaceModel > [virtual], fe::ext::SparseMatrix1< t_solve_real >, fe::ext::SparseMatrix2x2< t_solve_real >, fe::ext::SparseMatrix3x3< Real >, and fe::ext::SparseMatrix3x3< t_solve_real >.

Classes

class  Hub
 Reference hub used by Component::adjoin() More...
 

Public Member Functions

const Stringname (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< Registryregistry (void) const
 Get the Registry that created this component. More...
 
void adjoin (sp< Component > spComponent)
 Tie this component's lifetime to another. More...
 
sp< Componentcreate (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< Librarylibrary (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 Protectableclone (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 Member Functions

void assignHub (Hub *pHub)
 
void setStray (BWORD stray)
 

Private Attributes

String m_name
 
sp< Librarym_spLibrary
 
hp< Hubm_hpHub
 
I32 m_factoryIndex
 
BWORD m_singleton
 
BWORD m_stray
 

Related Functions

(Note that these are not member functions.)

FE_DL_EXPORT void FE_CDECL checkUnload (sp< Library > &pLibrary, Component *pComponent=NULL)
 Delete the component and unload libraries where appropriate. More...
 

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)
 

Detailed Description

Base for all interfacable components.

Member Function Documentation

◆ acquire()

void Component::acquire ( void  )
inlinevirtual

Specialized reference increment.

Reimplemented from fe::Counted.

References fe::Counted::acquire().

◆ adjoin()

void Component::adjoin ( sp< Component spComponent)

Tie this component's lifetime to another.

A hub is used to keep all components in a group alive as long as at least one of them is referenced (in addition to one reference each by the hub). Once the reference count of every component in the group drops to one, the hub destructs and all the components collapse.

Each component can only be adjoined once. A component can be adjoined to by any number of other components.

Adjoining can happen in any order and it doesn't matter which existing component in a particular group a component adjoins to.

fe::hp's do not count as references. It is usually good practice for Components within the same hub to only retain fe::hp's to each other, not fe::sp's. As long as fe::sp's exist, other than from the hub, the group will persist indefinitely.

◆ create()

sp< Component > Component::create ( const String implementation,
BWORD  quiet = FALSE 
) const

Convienience function to registry()->create()

Referenced by fe::ext::TireISystem::compile(), and fe::Registry::create().

◆ disjoin()

void Component::disjoin ( void  )

Untie component from Hub, if connected.

◆ factoryIndex()

I32 fe::Component::factoryIndex ( void  )
inline

Get the library's factory index.

A negative number indicates no known factory.

Referenced by fe::Library::factoryName().

◆ isSingleton()

BWORD fe::Component::isSingleton ( void  )
inline

Return whether component is a singleton.

References fe::Counted::acquire().

◆ library()

sp<Library> fe::Component::library ( void  )
inline

Get the library that created the component.

◆ name()

const String& fe::Component::name ( void  ) const
inline

Return the components chosen name.

Referenced by fe::LayoutAV::populate(), and fe::Scope::registerFactory().

◆ registry()

hp< Registry > Component::registry ( void  ) const

Get the Registry that created this component.

This allows any component to easily create other components. The Registry can also point you to the Master.

References fe::hp< T >::isValid().

Referenced by fe::ext::TireISystem::compile(), fe::Scope::initialize(), fe::ext::DrawOpenGL::setContrast(), fe::ext::DroneMission::start(), and fe::ext::SurfaceGroundTireSystem::step().

◆ release()

void Component::release ( void  )
inlinevirtual

Specialized reference decrement.

This virtual adds functionality to unload libraries under specific circumstances.

Reimplemented from fe::Counted.

◆ setFactoryIndex()

void fe::Component::setFactoryIndex ( I32  a_factoryIndex)
inline

Set the library's factory index.

◆ setLibrary()

void Component::setLibrary ( sp< Library spLibrary)

Store a reference to the library used to instantiate this component.

Setting this value externally may be ignored or cause an assertion.

This reference provide two roles:

  • It prevents this library from being unloaded while this component persists.
  • If this is the last component of an abandoned library, the end-life of this component will cause the library to unload.

◆ setName()

void fe::Component::setName ( const String name)
inline

Rename the component to anything you want.

The default name is the implementation name as given by the factory.

◆ setSingleton()

void fe::Component::setSingleton ( BWORD  set)
inline

Specify whether component is a singleton.

◆ verboseName()

const String fe::Component::verboseName ( void  ) const
inline

Return the annotated chosen name.

Friends And Related Function Documentation

◆ checkUnload()

FE_DL_EXPORT void FE_CDECL checkUnload ( sp< Library > &  pLibrary,
Component pComponent = NULL 
)
related

Delete the component and unload libraries where appropriate.

Under the right circumstances, this unloads one or more unneeded libraries. This function is reused by fe::Registry with pComponent=NULL.


The documentation for this class was generated from the following files: