|
Choreonoid
1.8
|
#include <Item.h>
Public Types | |
| 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 |
Public Member Functions | |
| virtual | ~Item () |
| Item & | operator= (const Item &rhs)=delete |
| int | classId () const |
| Item * | createNewInstance () const |
| void | assign (Item *srcItem) |
| Copy item properties as much as possible like the assignment operator. More... | |
| Item * | duplicate (Item *duplicatedParentItem=nullptr) const |
| Item * | duplicateSubTree () const |
| This function creates a copy of the item including its descendant items. More... | |
| Item * | duplicateAll () 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 () |
| 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 |
| Item * | childItem () const |
| Item * | prevItem () const |
| Item * | nextItem () const |
| Item * | lastChildItem () const |
| Item * | parentItem () const |
| Item * | headItem () const |
| RootItem * | findRootItem () const |
| bool | isConnectedToRoot () const |
| Item * | localRootItem () 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="") |
| Item * | findItem (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 |
| Item * | findChildItem (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 |
| Item * | findSubItem (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()> | sigPositionChanged () |
| SignalProxy< void(Item *topItem, Item *prevTopParentItem)> | sigPositionChanged2 () |
| 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 |
| std::string | fileName () const |
| const std::string & | fileFormat () const |
| const Mapping * | fileOptions () 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) |
| Item * | findOriginalItem () const |
| Item * | findReplacementItem () const |
| void | putProperties (PutPropertyFunction &putProperty) |
| virtual bool | store (Archive &archive) |
| virtual bool | restore (const Archive &archive) |
Public Member Functions inherited from cnoid::Referenced | |
| virtual | ~Referenced () |
Static Public Member Functions | |
| template<class ItemType > | |
| static ItemPredicate | getItemPredicate () |
| template<class ItemType > | |
| static ItemPredicate | getItemPredicate (std::function< bool(ItemType *item)> pred) |
| static Item * | find (const std::string &path) |
Protected Member Functions | |
| 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 Item * | doDuplicate () const |
| Override this function to allow duplication of an instance. More... | |
| virtual Item * | doDuplicate (Item *duplicatedParentItem) const |
| virtual bool | onNewPositionCheck (bool isManualOperation, std::function< void()> &out_callbackWhenAdded) |
| virtual void | onAddedToParent () |
| virtual void | onPositionChanged () |
| virtual void | onConnectedToRoot () |
| virtual void | onRemovedFromParent (Item *parentItem, bool isParentBeingDeleted) |
| virtual void | onDisconnectedFromRoot () |
| virtual bool | onChildItemAboutToBeAdded (Item *childItem, bool isManualOperation) |
| virtual void | doPutProperties (PutPropertyFunction &putProperty) |
Protected Member Functions inherited from cnoid::Referenced | |
| Referenced () | |
| Referenced (const Referenced &) | |
| int | refCount () const |
| typedef std::function<bool(Item* item)> cnoid::Item::ItemPredicate |
| enum cnoid::Item::CheckId |
|
protected |
|
protected |
|
protected |
|
virtual |
| bool Item::addChildItem | ( | Item * | item, |
| bool | isManualOperation = false |
||
| ) |
| std::vector< ItemAddon * > Item::addons | ( | ) |
| bool Item::addSubItem | ( | Item * | item | ) |
This function adds a sub item to the item. The sub item is an item that is a required element of the main item, and the sub item cannot be removed from the main item.
| void Item::assign | ( | Item * | srcItem | ) |
Copy item properties as much as possible like the assignment operator.
|
inline |
|
inline |
|
inline |
| void Item::clearChildren | ( | ) |
| void Item::clearFileInformation | ( | ) |
Use this function to disable the implicit overwrite next time.
| int Item::countDescendantItems | ( | ) | const |
| Item * Item::createNewInstance | ( | ) | const |
|
inline |
|
inline |
|
virtual |
Reimplemented in cnoid::CoordinateFrameItem.
|
protectedvirtual |
Implement the code to copy properties like the assingment operator.
Reimplemented in cnoid::BodyItem.
|
protectedvirtual |
Override this function to allow duplication of an instance.
Reimplemented in cnoid::BodyItem, cnoid::MultiPointSetItem, cnoid::CoordinateFrameListItem, cnoid::PointSetItem, cnoid::RootItem, cnoid::AISTSimulatorItem, cnoid::BodyMotionItem, cnoid::PositionTagGroupItem, cnoid::MprProgramItemBase, cnoid::CoordinateFrameItem, cnoid::WorldItem, cnoid::WorldLogFileItem, cnoid::BodyTrackingCameraItem, cnoid::SceneItem, cnoid::BodyMarkerItem, cnoid::MultiSeqItem< MultiSeqType >, cnoid::PythonScriptItem, cnoid::PythonSimScriptItem, cnoid::Vector3SeqItem, cnoid::ReferencedObjectSeqItem, cnoid::SimpleControllerItem, cnoid::BodyMotionControllerItem, cnoid::IoConnectionMapItem, cnoid::MprMultiVariableListItem, cnoid::SubProjectItem, cnoid::MessageLogItem, cnoid::MultiDeviceStateSeqItem, cnoid::LightingItem, cnoid::BodyContactPointLoggerItem, cnoid::SensorVisualizerItem, cnoid::FolderItem, cnoid::LinkOffsetFrameListItem, cnoid::ControllerLogItem, cnoid::MaterialTableItem, cnoid::KinematicSimulatorItem, cnoid::AudioItem, cnoid::GLVisionSimulatorItem, cnoid::MediaItem, cnoid::CollisionSeqItem, cnoid::ZMPSeqItem, and cnoid::ExtCommandItem.
Use this overload if the duplication process needs to know the duplicated parent item.
Reimplemented in cnoid::DeviceOverwriteItem, and cnoid::LinkShapeOverwriteItem.
|
protectedvirtual |
Override this function to put properties of the item.
Reimplemented in cnoid::SimulatorItem, cnoid::BodyItem, cnoid::MultiPointSetItem, cnoid::DeviceOverwriteItem, cnoid::CoordinateFrameListItem, cnoid::MprControllerItemBase, cnoid::PointSetItem, cnoid::ControllerItem, cnoid::AISTSimulatorItem, cnoid::PositionTagGroupItem, cnoid::CoordinateFrameItem, cnoid::WorldLogFileItem, cnoid::WorldItem, cnoid::SceneItem, cnoid::BodyTrackingCameraItem, cnoid::MprProgramItemBase, cnoid::BodyMarkerItem, cnoid::LinkShapeOverwriteItem, cnoid::AbstractMultiSeqItem, cnoid::PythonScriptItem, cnoid::PythonSimScriptItem, cnoid::SimpleControllerItem, cnoid::BodyMotionControllerItem, cnoid::MprMultiVariableListItem, cnoid::SubProjectItem, cnoid::MessageLogItem, cnoid::LightingItem, cnoid::AbstractSeqItem, cnoid::KinematicSimulatorItem, cnoid::MaterialTableItem, cnoid::AudioItem, cnoid::GLVisionSimulatorItem, cnoid::SimulationScriptItem, cnoid::MediaItem, cnoid::ZMPSeqItem, cnoid::ExtCommandItem, and cnoid::SubSimulatorItem.
|
inline |
| Item * Item::duplicateSubTree | ( | ) | const |
This function creates a copy of the item including its descendant items.
| const std::string & Item::fileFormat | ( | ) | const |
| std::time_t Item::fileModificationTime | ( | ) | const |
| std::string Item::fileName | ( | ) | const |
| const Mapping * Item::fileOptions | ( | ) | const |
| const std::string & Item::filePath | ( | ) | const |
|
inlinestatic |
This is equivalent to RootItem::instance()->findItem(path);
|
inline |
|
inline |
|
inline |
Find an item that has the corresponding path from a child item to it
|
inline |
|
inline |
|
inline |
Find an item that has the corresponding path to it in the sub tree
|
inline |
|
inline |
| Item * Item::findOriginalItem | ( | ) | const |
|
inline |
| Item * Item::findReplacementItem | ( | ) | const |
| RootItem * Item::findRootItem | ( | ) | const |
|
inline |
Find a sub item that has the corresponding path from a direct sub item to it
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |
| bool Item::hasAttribute | ( | Attribute | attribute | ) | const |
| Item * Item::headItem | ( | ) | const |
| bool Item::isChecked | ( | int | checkId = PrimaryCheck | ) | const |
| bool Item::isConnectedToRoot | ( | ) | const |
| bool Item::isConsistentWithFile | ( | ) | const |
| bool Item::isOwnedBy | ( | Item * | item | ) | const |
|
inline |
| bool Item::isSubItem | ( | ) | const |
| bool Item::isTemporal | ( | ) | const |
If this is true, the item is not automatically saved or overwritten when a project is saved. For example, a motion item which is produced as a simulation result may be an temporal item because a user may not want to save the result. If a user manually save the item, the item becomes a non-temporal item. Or if a child item is manually attached to a temporal item, the item becomes non-temporal one, too.
|
inline |
| bool Item::load | ( | const std::string & | filename, |
| const std::string & | format = std::string(), |
||
| const Mapping * | options = nullptr |
||
| ) |
This function loads the data of the item from a file by using a pre-registered loading function.
To make this function available, a loading function has to be registered to an ItemManager in advance by calling the addLoader() or addLoaderAndSaver() function. Otherwise, this function cannot be used. Note that this function should not be overloaded or overridden in the derived classes.
| bool Item::load | ( | const std::string & | filename, |
| Item * | parent, | ||
| const std::string & | format = std::string(), |
||
| const Mapping * | options = nullptr |
||
| ) |
| parent | specify this when the item is newly created one and will be attached to a parent item if loading succeeds. |
| Item * Item::localRootItem | ( | ) | const |
|
inline |
|
inline |
| void Item::notifyNameChange | ( | ) |
|
virtual |
Reimplemented in cnoid::BodyMotionItem, cnoid::WorldLogFileItem, and cnoid::PointSetItem.
| int Item::numCheckStates | ( | ) | const |
|
inline |
|
protectedvirtual |
Reimplemented in cnoid::CoordinateFrameItem.
|
protectedvirtual |
This function is called when a child item is about to added to this item.
Reimplemented in cnoid::CoordinateFrameListItem, and cnoid::BodyMotionItem.
|
protectedvirtual |
This function is called when the item has been connected to the tree including the root item. Note that the onPositionChanged function is called after this function.
Reimplemented in cnoid::BodyItem, cnoid::PositionTagGroupItem, cnoid::MprProgramItemBase, cnoid::SubProjectItem, and cnoid::MessageLogItem.
|
protectedvirtual |
Reimplemented in cnoid::SimulatorItem, cnoid::CoordinateFrameListItem, cnoid::MprControllerItemBase, cnoid::PositionTagGroupItem, cnoid::PythonScriptItem, cnoid::PythonSimScriptItem, cnoid::SimpleControllerItem, cnoid::BodyMotionControllerItem, cnoid::MessageLogItem, cnoid::SensorVisualizerItem, and cnoid::ExtCommandItem.
|
protectedvirtual |
Reimplemented in cnoid::BodyElementOverwriteItem, and cnoid::PositionTagGroupItem.
|
protectedvirtual |
This function is called when the item position in the whole item tree is changed. Note that this function is not called when the item is not connected to the root even if the item is newly attached to another item that is not connected to the root. For such items, the function is called for each item when the sub tree is connected to the root.
Reimplemented in cnoid::BodyElementOverwriteItem, cnoid::SimulatorItem, cnoid::BodyItem, cnoid::CoordinateFrameListItem, cnoid::MprProgramItemBase, cnoid::WorldLogFileItem, cnoid::BodyTrackingCameraItem, cnoid::BodyMarkerItem, cnoid::SimpleControllerItem, cnoid::IoConnectionMapItem, and cnoid::SensorVisualizerItem.
|
protectedvirtual |
Reimplemented in cnoid::CoordinateFrameItem.
| bool Item::overwrite | ( | bool | forceOverwrite = false, |
| const std::string & | format = std::string() |
||
| ) |
This function save the data of the item to the file from which the data of the item has been loaded. If the data has not been loaded from a file, a file save dialog opens and user specifies a file.
|
inline |
|
inline |
| void Item::putProperties | ( | PutPropertyFunction & | putProperty | ) |
| bool Item::reload | ( | ) |
| void Item::removeAddon | ( | ItemAddon * | addon | ) |
| void Item::removeFromParentItem | ( | ) |
| bool Item::replace | ( | Item * | originalItem | ) |
|
virtual |
Reimplemented in cnoid::SimulatorItem, cnoid::BodyItem, cnoid::DeviceOverwriteItem, cnoid::MprControllerItemBase, cnoid::ControllerItem, cnoid::PointSetItem, cnoid::CoordinateFrameListItem, cnoid::RootItem, cnoid::MultiPointSetItem, cnoid::AISTSimulatorItem, cnoid::BodyMotionItem, cnoid::PositionTagGroupItem, cnoid::WorldLogFileItem, cnoid::WorldItem, cnoid::BodyTrackingCameraItem, cnoid::MprProgramItemBase, cnoid::BodyMarkerItem, cnoid::SceneItem, cnoid::LinkShapeOverwriteItem, cnoid::CoordinateFrameItem, cnoid::PythonScriptItem, cnoid::PythonSimScriptItem, cnoid::SimpleControllerItem, cnoid::BodyMotionControllerItem, cnoid::SubProjectItem, cnoid::MessageLogItem, cnoid::LightingItem, cnoid::IoConnectionMapItem, cnoid::MultiDeviceStateSeqItem, cnoid::SensorVisualizerItem, cnoid::MprMultiVariableListItem, cnoid::AbstractSeqItem, cnoid::KinematicSimulatorItem, cnoid::FolderItem, cnoid::MaterialTableItem, cnoid::AudioItem, cnoid::GLVisionSimulatorItem, cnoid::SimulationScriptItem, cnoid::MediaItem, cnoid::ExtCommandItem, cnoid::CollisionSeqItem, and cnoid::SubSimulatorItem.
| bool Item::save | ( | const std::string & | filename, |
| const std::string & | format = std::string(), |
||
| const Mapping * | options = nullptr |
||
| ) |
This function saves the data of the item to a file by using a pre-registered saving function.
To make this function available, a saving function has to be registered to an ItemManager in advance by calling the addSaver() or addLoaderAndSaver() function. Otherwise, this function cannot be used. Note that this function should not be overloaded or overridden in the derived classes.
|
inline |
| bool Item::setAddon | ( | ItemAddon * | addon | ) |
| void Item::setAttribute | ( | Attribute | attribute | ) |
| void Item::setChecked | ( | bool | on | ) |
| void Item::setChecked | ( | int | checkId, |
| bool | on | ||
| ) |
| void Item::setConsistentWithFile | ( | bool | isConsistent | ) |
| void Item::setDisplayNameModifier | ( | std::function< std::string(const Item *item)> | modifier | ) |
|
virtual |
| void Item::setSelected | ( | bool | on, |
| bool | isCurrent = false |
||
| ) |
| void Item::setSubItemAttributes | ( | ) |
| void Item::setSubTreeItemsSelected | ( | bool | on | ) |
| void Item::setTemporal | ( | bool | on = true | ) |
| SignalProxy< void(int checkId, bool on)> Item::sigAnyCheckToggled | ( | ) |
| SignalProxy< void(bool on)> Item::sigCheckToggled | ( | int | checkId = PrimaryCheck | ) |
|
inline |
| SignalProxy< void()> Item::sigDisconnectedFromRoot | ( | ) |
| SignalProxy< void(const std::string &oldName)> Item::sigNameChanged | ( | ) |
| SignalProxy< void()> Item::sigPositionChanged | ( | ) |
This signal is emitted when the position of this item in the item tree is changed. Being added to the tree and being removed from the tree are also the events to emit this signal. This signal is also emitted for descendent items when the position of an ancestor item is changed. This signal is emitted before RootItem::sigTreeChanged();
| SignalProxy< void(Item *topItem, Item *prevTopParentItem)> Item::sigPositionChanged2 | ( | ) |
The following signal name is temporary. This is a variant of sigPositionChanged, and should be a standard sigunature. When the template implementation of the Signal class is improved to connect to functions omitting some arguments defined in a signal, this sigunare should replace the old sigunature with no arguments. Do not use this signal if you don't have a special reason because this function name will be removed.
| SignalProxy< void(bool isSelected)> Item::sigSelectionChanged | ( | ) |
| SignalProxy< void()> Item::sigSubTreeChanged | ( | ) |
| SignalProxy< void()> Item::sigUpdated | ( | ) |
|
virtual |
Reimplemented in cnoid::SimulatorItem, cnoid::BodyItem, cnoid::DeviceOverwriteItem, cnoid::MprControllerItemBase, cnoid::ControllerItem, cnoid::PointSetItem, cnoid::CoordinateFrameListItem, cnoid::RootItem, cnoid::MultiPointSetItem, cnoid::AISTSimulatorItem, cnoid::BodyMotionItem, cnoid::PositionTagGroupItem, cnoid::WorldLogFileItem, cnoid::WorldItem, cnoid::BodyTrackingCameraItem, cnoid::MprProgramItemBase, cnoid::BodyMarkerItem, cnoid::SceneItem, cnoid::LinkShapeOverwriteItem, cnoid::CoordinateFrameItem, cnoid::PythonScriptItem, cnoid::PythonSimScriptItem, cnoid::SimpleControllerItem, cnoid::BodyMotionControllerItem, cnoid::SubProjectItem, cnoid::MessageLogItem, cnoid::LightingItem, cnoid::IoConnectionMapItem, cnoid::MultiDeviceStateSeqItem, cnoid::SensorVisualizerItem, cnoid::MprMultiVariableListItem, cnoid::AbstractSeqItem, cnoid::KinematicSimulatorItem, cnoid::FolderItem, cnoid::MaterialTableItem, cnoid::AudioItem, cnoid::GLVisionSimulatorItem, cnoid::SimulationScriptItem, cnoid::MediaItem, cnoid::ExtCommandItem, cnoid::CollisionSeqItem, and cnoid::SubSimulatorItem.
| void Item::suggestFileUpdate | ( | ) |
| bool Item::traverse | ( | std::function< bool(Item *)> | pred | ) |
|
inline |
| void Item::unsetAttribute | ( | Attribute | attribute | ) |
| void Item::updateFileInformation | ( | const std::string & | filename, |
| const std::string & | format, | ||
| Mapping * | options = nullptr |
||
| ) |
1.8.17