Choreonoid  1.8
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
cnoid::MprControllerItemBase Class Reference

#include <MprControllerItemBase.h>

Inheritance diagram for cnoid::MprControllerItemBase:
cnoid::ControllerItem cnoid::Item cnoid::Referenced

Public Member Functions

 MprControllerItemBase ()
 
 MprControllerItemBase (const MprControllerItemBase &org)
 
virtual ~MprControllerItemBase ()
 
virtual double timeStep () const override
 
double speedRatio () const
 
void setSpeedRatio (double r)
 
virtual bool initialize (ControllerIO *io) override final
 
virtual bool start () override final
 
virtual void input () override final
 
virtual bool control () override final
 
virtual void output () override final
 
virtual void stop () override final
 
- Public Member Functions inherited from cnoid::ControllerItem
 ControllerItem ()
 
 ControllerItem (const ControllerItem &org)
 
virtual ~ControllerItem ()
 
bool isActive () const
 
bool isNoDelayMode () const
 
virtual void setNoDelayMode (bool on)
 
const std::string & optionString () const
 
void setOptions (const std::string &options)
 
virtual ControllerLogItemcreateLogItem ()
 
virtual void log ()
 
bool isImmediateMode () const
 
void setImmediateMode (bool on)
 
- Public Member Functions inherited from cnoid::Item
virtual ~Item ()
 
Itemoperator= (const Item &rhs)=delete
 
int classId () const
 
ItemcreateNewInstance () const
 
void assign (Item *srcItem)
 Copy item properties as much as possible like the assignment operator. More...
 
Itemduplicate (Item *duplicatedParentItem=nullptr) const
 
ItemduplicateSubTree () const
 This function creates a copy of the item including its descendant items. More...
 
ItemduplicateAll () const
 
const std::string & name () const
 
virtual bool setName (const std::string &name)
 
virtual std::string displayName () const
 
void setDisplayNameModifier (std::function< std::string(const Item *item)> modifier)
 
SignalProxy< void(const std::string &oldName)> sigNameChanged ()
 
void notifyNameChange ()
 This function notifies the system of a displayName change. More...
 
void setAttribute (Attribute attribute)
 
void unsetAttribute (Attribute attribute)
 
bool hasAttribute (Attribute attribute) const
 
bool isSubItem () const
 
void setSubItemAttributes ()
 
bool isTemporal () const
 
void setTemporal (bool on=true)
 
bool isSelected () const
 
void setSelected (bool on, bool isCurrent=false)
 
void setSubTreeItemsSelected (bool on)
 
bool isChecked (int checkId=PrimaryCheck) const
 
void setChecked (bool on)
 
void setChecked (int checkId, bool on)
 
int numCheckStates () const
 
int numChildren () const
 
int countDescendantItems () const
 
ItemchildItem () const
 
ItemprevItem () const
 
ItemnextItem () const
 
ItemlastChildItem () const
 
ItemparentItem () const
 
ItemheadItem () const
 
RootItemfindRootItem () const
 
bool isConnectedToRoot () const
 
ItemlocalRootItem () const
 
bool addChildItem (Item *item, bool isManualOperation=false)
 
bool insertChildItem (Item *item, Item *nextItem, bool isManualOperation=false)
 
bool insertChild (Item *position, Item *item, bool isManualOperation=false)
 
bool addSubItem (Item *item)
 
bool insertSubItem (Item *item, Item *nextItem)
 
void removeFromParentItem ()
 
void detachFromParentItem ()
 
void clearChildren ()
 
template<class ItemType >
ItemType * find (const std::string &path="")
 
ItemfindItem (const std::string &path) const
 
template<class ItemType >
ItemType * findItem (const std::string &path) const
 
template<class ItemType >
ItemType * findItem (std::function< bool(ItemType *item)> pred=nullptr) const
 
ItemfindChildItem (const std::string &path, std::function< bool(Item *item)> pred=nullptr) const
 
template<class ItemType >
ItemType * findChildItem (const std::string &path, std::function< bool(ItemType *item)> pred=nullptr) const
 
template<class ItemType >
ItemType * findChildItem (std::function< bool(ItemType *item)> pred=nullptr) const
 
ItemfindSubItem (const std::string &path) const
 
template<class ItemType >
ItemType * findSubItem (const std::string &path="") const
 
template<class ItemType >
ItemType * findOwnerItem (bool includeSelf=false) const
 
bool isOwnedBy (Item *item) const
 
ItemList childItems (std::function< bool(Item *item)> pred=nullptr) const
 
template<class ItemType >
ItemList< ItemType > childItems (std::function< bool(ItemType *item)> pred=nullptr) const
 
ItemList descendantItems (std::function< bool(Item *item)> pred=nullptr) const
 
template<class ItemType >
ItemList< ItemType > descendantItems (std::function< bool(ItemType *item)> pred=nullptr) const
 
ItemList selectedDescendantItems (std::function< bool(Item *item)> pred=nullptr) const
 
template<class ItemType >
ItemList< ItemType > selectedDescendantItems (std::function< bool(Item *item)> pred=nullptr) const
 
bool traverse (std::function< bool(Item *)> pred)
 
template<class ItemType >
bool traverse (std::function< bool(ItemType *item)> pred=nullptr)
 
SignalProxy< void()> sigTreePathChanged ()
 
SignalProxy< void()> sigTreePositionChanged ()
 
SignalProxy< void(Item *topItem, Item *prevTopParentItem)> sigTreePositionChanged2 ()
 
SignalProxy< void()> sigPositionChanged ()
 
SignalProxy< void()> sigSubTreeChanged ()
 
SignalProxy< void()> sigDisconnectedFromRoot ()
 
SignalProxy< void()> sigDetachedFromRoot ()
 
SignalProxy< void(bool on)> sigSelectionChanged ()
 
SignalProxy< void(int checkId, bool on)> sigAnyCheckToggled ()
 
SignalProxy< void(bool on)> sigCheckToggled (int checkId=PrimaryCheck)
 
virtual void notifyUpdate ()
 
SignalProxy< void()> sigUpdated ()
 
bool setAddon (ItemAddon *addon)
 
void removeAddon (ItemAddon *addon)
 
template<class AddonType >
AddonType * findAddon ()
 
template<class AddonType >
AddonType * getAddon ()
 
std::vector< ItemAddon * > addons ()
 
bool load (const std::string &filename, const std::string &format=std::string(), const Mapping *options=nullptr)
 
bool load (const std::string &filename, Item *parent, const std::string &format=std::string(), const Mapping *options=nullptr)
 
bool save (const std::string &filename, const std::string &format=std::string(), const Mapping *options=nullptr)
 
bool overwrite (bool forceOverwrite=false, const std::string &format=std::string())
 
const std::string & filePath () const
 Full path file name. More...
 
std::string fileName () const
 File name without the directory. More...
 
const std::string & fileFormat () const
 
const MappingfileOptions () const
 
std::time_t fileModificationTime () const
 
bool isConsistentWithFile () const
 
void updateFileInformation (const std::string &filename, const std::string &format, Mapping *options=nullptr)
 
void setConsistentWithFile (bool isConsistent)
 
void suggestFileUpdate ()
 
void clearFileInformation ()
 Use this function to disable the implicit overwrite next time. More...
 
bool reload ()
 
bool replace (Item *originalItem)
 
ItemfindOriginalItem () const
 
ItemfindReplacementItem () const
 
void putProperties (PutPropertyFunction &putProperty)
 
- Public Member Functions inherited from cnoid::Referenced
virtual ~Referenced ()
 

Static Public Member Functions

static void initializeClass (ExtensionManager *ext)
 
- Static Public Member Functions inherited from cnoid::ControllerItem
static void initializeClass (ExtensionManager *ext)
 
- Static Public Member Functions inherited from cnoid::Item
template<class ItemType >
static ItemPredicate getItemPredicate ()
 
template<class ItemType >
static ItemPredicate getItemPredicate (std::function< bool(ItemType *item)> pred)
 
static Itemfind (const std::string &path)
 

Protected Member Functions

template<class StatementType >
void registerStatementInterpreter (std::function< bool(StatementType *statement)> interpret)
 
void registerBaseStatementInterpreters ()
 
void setResidentInputFunction (std::function< void()> input)
 
MprProgramItemBasegetStartupProgramItem ()
 
MprProgramgetStartupProgram ()
 
MprProgramgetCurrentProgram ()
 
MprProgram::iterator getCurrentIterator ()
 
void setCurrent (MprProgram::iterator iter)
 
void setCurrent (MprProgram *program, MprProgram::iterator iter, MprProgram::iterator upperNext)
 
MprProgramfindProgram (const std::string &name)
 
LinkKinematicsKitlinkKinematicsKitForControl ()
 
void pushControlFunctions (std::function< bool()> control, std::function< void()> input=nullptr, std::function< void()> output=nullptr)
 
void pushOutputOnceFunction (std::function< void()> outputOnce)
 
virtual bool onInitialize (ControllerIO *io)
 
virtual bool onStart ()
 
virtual bool onStop ()
 
virtual bool initializeVariables ()
 
void setVariableListSync (MprVariableList *listInGui, MprVariableList *listInController)
 
virtual stdx::optional< MprVariable::ValueevalExpressionAsVariableValue (std::string::const_iterator &io_expressionBegin, std::string::const_iterator expressionEnd)
 
virtual std::function< bool(MprVariable::Value value)> evalExpressionAsVariableToAssginValue (const std::string &expression)
 
virtual void onDisconnectedFromRoot () override
 
virtual void doPutProperties (PutPropertyFunction &putProperty) override
 
virtual bool store (Archive &archive) override
 
virtual bool restore (const Archive &archive) override
 
- Protected Member Functions inherited from cnoid::ControllerItem
virtual void onOptionsChanged ()
 
- Protected Member Functions inherited from cnoid::Item
 Item ()
 
 Item (const std::string &name)
 
 Item (const Item &item)
 
virtual void doAssign (Item *srcItem)
 Implement the code to copy properties like the assingment operator. More...
 
virtual ItemdoDuplicate () const
 Override this function to allow duplication of an instance. More...
 
virtual ItemdoDuplicate (Item *duplicatedParentItem) const
 
virtual bool onNewTreePositionCheck (bool isManualOperation, std::function< void()> &out_callbackWhenAdded)
 
virtual void onAddedToParent ()
 
virtual void onTreePathChanged ()
 
virtual void onTreePositionChanged ()
 
virtual void onPositionChanged ()
 
virtual void onConnectedToRoot ()
 
virtual void onRemovedFromParent (Item *parentItem, bool isParentBeingDeleted)
 
virtual bool onChildItemAboutToBeAdded (Item *childItem, bool isManualOperation)
 
- Protected Member Functions inherited from cnoid::Referenced
 Referenced ()
 
 Referenced (const Referenced &)
 
int refCount () const
 

Additional Inherited Members

- Public Types inherited from cnoid::ControllerItem
typedef ControllerIO Target
 
- Public Types inherited from cnoid::Item
enum  Attribute {
  SubItem, Attached, Temporal, LoadOnly,
  NumAttributes, SUB_ITEM = SubItem, TEMPORAL = Temporal, LOAD_ONLY = LoadOnly
}
 
enum  CheckId { LogicalSumOfAllChecks = -1, PrimaryCheck = 0 }
 
typedef std::function< bool(Item *item)> ItemPredicate
 

Constructor & Destructor Documentation

◆ MprControllerItemBase() [1/2]

MprControllerItemBase::MprControllerItemBase ( )

◆ MprControllerItemBase() [2/2]

MprControllerItemBase::MprControllerItemBase ( const MprControllerItemBase org)

◆ ~MprControllerItemBase()

MprControllerItemBase::~MprControllerItemBase ( )
virtual

Member Function Documentation

◆ control()

bool MprControllerItemBase::control ( )
finaloverridevirtual

Reimplemented from cnoid::ControllerItem.

◆ doPutProperties()

void MprControllerItemBase::doPutProperties ( PutPropertyFunction putProperty)
overrideprotectedvirtual

This function is used to put a standard properties of the item. You can implement the standard properties by overriding this function.

Note
The overridden function should call the same function of the parent class.

Reimplemented from cnoid::ControllerItem.

◆ evalExpressionAsVariableToAssginValue()

std::function< bool(MprVariable::Value value)> MprControllerItemBase::evalExpressionAsVariableToAssginValue ( const std::string &  expression)
protectedvirtual

◆ evalExpressionAsVariableValue()

stdx::optional< MprVariable::Value > MprControllerItemBase::evalExpressionAsVariableValue ( std::string::const_iterator &  io_expressionBegin,
std::string::const_iterator  expressionEnd 
)
protectedvirtual

◆ findProgram()

MprProgram * MprControllerItemBase::findProgram ( const std::string &  name)
protected

◆ getCurrentIterator()

MprProgram::iterator MprControllerItemBase::getCurrentIterator ( )
protected

◆ getCurrentProgram()

MprProgram * MprControllerItemBase::getCurrentProgram ( )
protected

◆ getStartupProgram()

MprProgram * MprControllerItemBase::getStartupProgram ( )
protected

This function returns the program instance cloned by the controller for the purpose of control.

◆ getStartupProgramItem()

MprProgramItemBase * MprControllerItemBase::getStartupProgramItem ( )
protected
Note
The MprProgram instance owned by the following item must not be used in the controller. The instance returned by the getMprProgram function can be used instead of it.

◆ initialize()

bool MprControllerItemBase::initialize ( ControllerIO io)
finaloverridevirtual

This function is called before the simulation world is initialized.

Note
If the io->body() returns a null pointer, a controller is not associated with a particular body. This is for a controller which does some general operations.
This function is called from the main thread.

Reimplemented from cnoid::ControllerItem.

◆ initializeClass()

void MprControllerItemBase::initializeClass ( ExtensionManager ext)
static

◆ initializeVariables()

bool MprControllerItemBase::initializeVariables ( )
protectedvirtual

◆ input()

void MprControllerItemBase::input ( )
finaloverridevirtual
Note
This function is called from the simulation thread.

Reimplemented from cnoid::ControllerItem.

◆ linkKinematicsKitForControl()

LinkKinematicsKit * MprControllerItemBase::linkKinematicsKitForControl ( )
protected

◆ onDisconnectedFromRoot()

void MprControllerItemBase::onDisconnectedFromRoot ( )
overrideprotectedvirtual

Reimplemented from cnoid::Item.

◆ onInitialize()

bool MprControllerItemBase::onInitialize ( ControllerIO io)
protectedvirtual

◆ onStart()

bool MprControllerItemBase::onStart ( )
protectedvirtual

◆ onStop()

bool MprControllerItemBase::onStop ( )
protectedvirtual

◆ output()

void MprControllerItemBase::output ( )
finaloverridevirtual
Note
This function is called from the simulation thread.

Reimplemented from cnoid::ControllerItem.

◆ pushControlFunctions()

void MprControllerItemBase::pushControlFunctions ( std::function< bool()>  control,
std::function< void()>  input = nullptr,
std::function< void()>  output = nullptr 
)
protected

◆ pushOutputOnceFunction()

void MprControllerItemBase::pushOutputOnceFunction ( std::function< void()>  outputOnce)
protected

◆ registerBaseStatementInterpreters()

void MprControllerItemBase::registerBaseStatementInterpreters ( )
protected

◆ registerStatementInterpreter()

template<class StatementType >
void cnoid::MprControllerItemBase::registerStatementInterpreter ( std::function< bool(StatementType *statement)>  interpret)
inlineprotected

◆ restore()

bool MprControllerItemBase::restore ( const Archive archive)
overrideprotectedvirtual

Reimplemented from cnoid::ControllerItem.

◆ setCurrent() [1/2]

void MprControllerItemBase::setCurrent ( MprProgram program,
MprProgram::iterator  iter,
MprProgram::iterator  upperNext 
)
protected

◆ setCurrent() [2/2]

void MprControllerItemBase::setCurrent ( MprProgram::iterator  iter)
protected

◆ setResidentInputFunction()

void MprControllerItemBase::setResidentInputFunction ( std::function< void()>  input)
protected

◆ setSpeedRatio()

void MprControllerItemBase::setSpeedRatio ( double  r)

◆ setVariableListSync()

void MprControllerItemBase::setVariableListSync ( MprVariableList listInGui,
MprVariableList listInController 
)
protected

◆ speedRatio()

double MprControllerItemBase::speedRatio ( ) const

◆ start()

bool MprControllerItemBase::start ( )
finaloverridevirtual

This function is called after the simulation world is initialized.

Reimplemented from cnoid::ControllerItem.

◆ stop()

void MprControllerItemBase::stop ( )
finaloverridevirtual
Note
This function is called from the main thread.

Reimplemented from cnoid::ControllerItem.

◆ store()

bool MprControllerItemBase::store ( Archive archive)
overrideprotectedvirtual

Reimplemented from cnoid::ControllerItem.

◆ timeStep()

double MprControllerItemBase::timeStep ( ) const
overridevirtual

Reimplemented from cnoid::ControllerItem.


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