class Core::Portable::Component
Overview
Basic component class for embedded systems. More…
#include <corecomponent.h> class Component: public Core::Portable::TypedObject, public Core::Portable::IParamObserver { public: // enums enum Flags; // structs struct Visitor; // fields kMutable; isMutable kOwnedByArray; static CStringPtr kClassIDAttr = "__classid"; // methods BEGIN_CORE_CLASS('Comp', Component); void addParameters(const ParamInfo infos[], int count, bool ownsInfo = false); virtual void construct(); PROPERTY_CSTRING_BUFFER(ParamInfo::kMaxNameLength, name, Name); isMutable PROPERTY_FLAG(flags, kSaveDisabled, isSaveDisabled); virtual isMutable virtual isOwnedByArray UIDRef getClassID() const; Component* getParent() const; Component* getRootComponent() const; void addChild(Component* c); void addChildren(ComponentArray* components); void removeChild(Component* c); bool insertChildAt(int index, Component* c); int countChildren() const; Component* getChild(int index) const; int getChildIndex(const Component* c) const; virtual Component* findChild(CStringPtr name) const; Component* lookupChild(CStringPtr path) const; void getComponentPath(CString256& path) const; template <class T> T* getCoreComponent(CStringPtr name) const; template <class T> T* getParentOfCoreType() const; void traverse(Visitor& visitor, bool deep); int countParameters() const; Parameter* getParameterAt(int index) const; Parameter* getParameterByTag(int tag) const; virtual Parameter* findParameter(CStringPtr name) const; Parameter* lookupParameter(CStringPtr path) const; void getParameterPath(CString256& path, Parameter* p) const; virtual void resetToDefaults( bool storableOnly = true, bool edit = false, const IStorageFilter* filter = nullptr ); virtual void paramChanged(Parameter* p, int msg); virtual bool load(const InputStorage& storage); virtual bool save(OutputStorage& storage) const; bool hasSaveData() const; bool needsSave() const; void setNeedsSave(bool needsSave); PROPERTY_VARIABLE(int, storageTag, StorageTag); static abs_time getLastEditTime(); };
Inherited Members
public: // typedefs typedef int32 TypeID; // fields static const TypeID kTypeID = 'IPaO'; // methods virtual void* castTo(TypeID typeId) = 0; virtual void* castTo(TypeID typeId); virtual void paramChanged(Parameter* p, int msg) = 0;
Detailed Documentation
Basic component class for embedded systems.
This design pattern structures program functionality into smaller and reusable pieces. Components and their childs make up the parameter tree attached to a graphical user interface or hardware front panel.
Fields
static CStringPtr kClassIDAttr = "__classid"
mutable component class identifier (keep in sync with CCL)
Methods
virtual void construct()
can be called for initialization after parameters have been added
virtual Component* findChild(CStringPtr name) const
override to make non-child components accessible
template <class T> T* getCoreComponent(CStringPtr name) const
uses core_cast
template <class T> T* getParentOfCoreType() const
uses core_cast
virtual Parameter* findParameter(CStringPtr name) const
override to make non-owned parameters accessible
PROPERTY_VARIABLE(int, storageTag, StorageTag)
delegate idle to children