Choreonoid
1.5
|
#include <Item.h>
Public Types | |
enum | Attribute { SUB_ITEM, TEMPORAL, LOAD_ONLY, NUM_ATTRIBUTES } |
Public Member Functions | |
virtual | ~Item () |
const std::string & | name () const |
virtual void | setName (const std::string &name) |
bool | hasAttribute (Attribute attribute) const |
Item * | childItem () const |
Item * | prevItem () const |
Item * | nextItem () const |
Item * | parentItem () const |
bool | addChildItem (Item *item, bool isManualOperation=false) |
bool | addSubItem (Item *item) |
bool | isSubItem () const |
void | detachFromParentItem () |
void | emitSigDetachedFromRootForSubTree () |
bool | insertChildItem (Item *item, Item *nextItem, bool isManualOperation=false) |
bool | insertSubItem (Item *item, Item *nextItem) |
bool | isTemporal () const |
void | setTemporal (bool on=true) |
RootItem * | findRootItem () const |
Item * | findItem (const std::string &path) const |
template<class ItemType > | |
ItemType * | findItem (const std::string &path) const |
template<class ItemType > | |
ItemType * | find (const std::string &path) |
Item * | findChildItem (const std::string &path) const |
template<class ItemType > | |
ItemType * | findChildItem (const std::string &path) const |
Item * | findSubItem (const std::string &path) const |
template<class ItemType > | |
ItemType * | findSubItem (const std::string &path) const |
Item * | headItem () const |
template<class ItemType > | |
ItemType * | findOwnerItem (bool includeSelf=false) |
bool | isOwnedBy (Item *item) const |
bool | traverse (boost::function< bool(Item *)> function) |
template<class ItemType > | |
bool | traverse (boost::function< bool(ItemType *item)> function) |
Item * | duplicate () const |
Item * | duplicateAll () const |
void | assign (Item *srcItem) |
bool | load (const std::string &filename, const std::string &format=std::string()) |
bool | load (const std::string &filename, Item *parent, const std::string &format=std::string()) |
bool | save (const std::string &filename, const std::string &format=std::string()) |
bool | overwrite (bool forceOverwrite=false, const std::string &format=std::string()) |
const std::string & | filePath () const |
const std::string & | fileFormat () const |
std::time_t | fileModificationTime () const |
bool | isConsistentWithFile () const |
void | clearFileInformation () |
void | suggestFileUpdate () |
void | putProperties (PutPropertyFunction &putProperty) |
virtual void | notifyUpdate () |
SignalProxy< void(const std::string &oldName)> | sigNameChanged () |
SignalProxy< void()> | sigUpdated () |
SignalProxy< void()> | sigPositionChanged () |
SignalProxy< void()> | sigDetachedFromRoot () |
SignalProxy< void()> | sigDisconnectedFromRoot () |
SignalProxy< void()> | sigSubTreeChanged () |
virtual bool | store (Archive &archive) |
virtual bool | restore (const Archive &archive) |
Referenced * | customData (int id) |
const Referenced * | customData (int id) const |
void | setCustomData (int id, ReferencedPtr data) |
void | clearCustomData (int id) |
![]() | |
virtual | ~Referenced () |
void | addRef () |
void | releaseRef () |
Static Public Member Functions | |
static Item * | find (const std::string &path) |
static SignalProxy< void(const char *type_info_name)> | sigClassUnregistered () |
Protected Member Functions | |
Item () | |
Item (const Item &item) | |
virtual void | onConnectedToRoot () |
virtual void | onDisconnectedFromRoot () |
virtual void | onPositionChanged () |
virtual bool | onChildItemAboutToBeAdded (Item *childItem, bool isManualOperation) |
virtual Item * | doDuplicate () const |
virtual void | doAssign (Item *srcItem) |
virtual void | doPutProperties (PutPropertyFunction &putProperty) |
void | setAttribute (Attribute attribute) |
void | unsetAttribute (Attribute attribute) |
![]() | |
Referenced () | |
Referenced (const Referenced &org) | |
int | refCount () const |
Friends | |
class | RootItem |
class | ItemTreeArchiver |
class | ItemManagerImpl |
|
protected |
|
protected |
|
virtual |
bool Item::addChildItem | ( | Item * | item, |
bool | isManualOperation = false |
||
) |
bool Item::addSubItem | ( | Item * | item | ) |
void Item::assign | ( | Item * | srcItem | ) |
Copy item properties as much as possible like the assignment operator
|
inline |
void Item::clearCustomData | ( | int | id | ) |
void Item::clearFileInformation | ( | ) |
Use this function to disable the implicit overwrite next time
Referenced * Item::customData | ( | int | id | ) |
const Referenced * Item::customData | ( | int | id | ) | const |
void Item::detachFromParentItem | ( | ) |
|
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::PointSetItem, cnoid::RTCItem, cnoid::BodyRTCItem, cnoid::MultiPointSetItem, cnoid::AISTSimulatorItem, cnoid::PoseSeqItem, cnoid::BodyMotionItem, cnoid::AudioItem, cnoid::WorldLogFileItem, cnoid::ODESimulatorItem, cnoid::MultiSeqItem< MultiSeqType >, cnoid::RootItem, cnoid::OpenHRPControllerItem, cnoid::WorldItem, cnoid::PythonScriptItem, cnoid::PythonSimScriptItem, cnoid::GLVisionSimulatorItem, cnoid::Vector3SeqItem, cnoid::SimpleControllerItem, cnoid::MediaItem, cnoid::BodyMotionControllerItem, cnoid::BulletSimulatorItem, cnoid::CollisionSeqItem, cnoid::OpenHRPClockGeneratorItem, cnoid::ExtCommandItem, cnoid::ZMPSeqItem, cnoid::SceneItem, cnoid::MultiDeviceStateSeqItem, cnoid::BodyTrackingCameraItem, cnoid::SensorVisualizerItem, cnoid::OpenHRPInterpreterServiceItem, cnoid::OpenHRPOnlineViewerItem, and cnoid::FolderItem.
|
protectedvirtual |
Override this function to put properties of the item.
Reimplemented in cnoid::SimulatorItem, cnoid::BodyItem, cnoid::ControllerItem, cnoid::PointSetItem, cnoid::RTCItem, cnoid::BodyRTCItem, cnoid::MultiPointSetItem, cnoid::AISTSimulatorItem, cnoid::PoseSeqItem, cnoid::AudioItem, cnoid::WorldLogFileItem, cnoid::ODESimulatorItem, cnoid::OpenHRPControllerItem, cnoid::WorldItem, cnoid::AbstractMultiSeqItem, cnoid::PythonScriptItem, cnoid::PythonSimScriptItem, cnoid::GLVisionSimulatorItem, cnoid::SimulationScriptItem, cnoid::SimpleControllerItem, cnoid::MediaItem, cnoid::BodyMotionControllerItem, cnoid::BulletSimulatorItem, cnoid::SceneItem, cnoid::OpenHRPClockGeneratorItem, cnoid::ExtCommandItem, cnoid::ZMPSeqItem, cnoid::BodyTrackingCameraItem, cnoid::SensorVisualizerItem, cnoid::OpenHRPInterpreterServiceItem, cnoid::OpenHRPOnlineViewerItem, cnoid::SubSimulatorItem, and cnoid::AbstractSeqItem.
Item * Item::duplicate | ( | ) | const |
Item * Item::duplicateAll | ( | ) | const |
void Item::emitSigDetachedFromRootForSubTree | ( | ) |
|
inline |
|
inline |
|
inline |
|
static |
|
inline |
Item * Item::findChildItem | ( | const std::string & | path | ) | const |
Find an item that has the corresponding path from a child item to it
|
inline |
Item * Item::findItem | ( | const std::string & | path | ) | const |
Find an item that has the corresponding path to it in the sub tree
|
inline |
|
inline |
RootItem * Item::findRootItem | ( | ) | const |
Item * Item::findSubItem | ( | const std::string & | path | ) | const |
Find a sub item that has the corresponding path from a direct sub item to it
|
inline |
|
inline |
Item * Item::headItem | ( | ) | const |
|
inline |
bool Item::isOwnedBy | ( | Item * | item | ) | const |
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.
bool Item::load | ( | const std::string & | filename, |
const std::string & | format = std::string() |
||
) |
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() |
||
) |
parentItem | specify this when the item is newly created one and will be attached to a parent item if loading succeeds. |
|
inline |
|
inline |
|
virtual |
Reimplemented in cnoid::BodyMotionItem, cnoid::WorldLogFileItem, and cnoid::PointSetItem.
|
protectedvirtual |
This function is called when a child item is about to added to this item.
Reimplemented in cnoid::BodyMotionItem.
|
protectedvirtual |
Reimplemented in cnoid::OpenHRPInterpreterServiceItem, and cnoid::OpenHRPOnlineViewerItem.
|
protectedvirtual |
Reimplemented in cnoid::SimulatorItem, cnoid::RTCItem, cnoid::BodyRTCItem, cnoid::OpenHRPControllerItem, cnoid::PythonScriptItem, cnoid::PythonSimScriptItem, cnoid::SimpleControllerItem, cnoid::BodyMotionControllerItem, cnoid::OpenHRPClockGeneratorItem, cnoid::ExtCommandItem, cnoid::OpenHRPInterpreterServiceItem, and cnoid::OpenHRPOnlineViewerItem.
|
protectedvirtual |
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 | ) |
|
virtual |
Reimplemented in cnoid::SimulatorItem, cnoid::BodyItem, cnoid::ControllerItem, cnoid::RTCItem, cnoid::PointSetItem, cnoid::BodyRTCItem, cnoid::AISTSimulatorItem, cnoid::PoseSeqItem, cnoid::MultiPointSetItem, cnoid::BodyMotionItem, cnoid::AudioItem, cnoid::WorldLogFileItem, cnoid::ODESimulatorItem, cnoid::OpenHRPControllerItem, cnoid::RootItem, cnoid::WorldItem, cnoid::PythonScriptItem, cnoid::PythonSimScriptItem, cnoid::GLVisionSimulatorItem, cnoid::SimulationScriptItem, cnoid::SimpleControllerItem, cnoid::MediaItem, cnoid::BodyMotionControllerItem, cnoid::BulletSimulatorItem, cnoid::OpenHRPClockGeneratorItem, cnoid::ExtCommandItem, cnoid::CollisionSeqItem, cnoid::SceneItem, cnoid::BodyTrackingCameraItem, cnoid::SensorVisualizerItem, cnoid::OpenHRPInterpreterServiceItem, cnoid::MultiDeviceStateSeqItem, cnoid::OpenHRPOnlineViewerItem, cnoid::SubSimulatorItem, cnoid::AbstractSeqItem, and cnoid::FolderItem.
bool Item::save | ( | const std::string & | filename, |
const std::string & | format = std::string() |
||
) |
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.
|
inlineprotected |
void Item::setCustomData | ( | int | id, |
ReferencedPtr | data | ||
) |
|
virtual |
Reimplemented in cnoid::BodyItem, cnoid::PoseSeqItem, cnoid::PointSetItem, cnoid::BodyTrackingCameraItem, and cnoid::SceneItem.
void Item::setTemporal | ( | bool | on = true | ) |
|
inlinestatic |
|
inline |
|
inline |
|
inline |
|
inline |
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();
|
inline |
|
inline |
|
virtual |
Reimplemented in cnoid::SimulatorItem, cnoid::BodyItem, cnoid::ControllerItem, cnoid::RTCItem, cnoid::PointSetItem, cnoid::BodyRTCItem, cnoid::AISTSimulatorItem, cnoid::PoseSeqItem, cnoid::MultiPointSetItem, cnoid::BodyMotionItem, cnoid::AudioItem, cnoid::WorldLogFileItem, cnoid::ODESimulatorItem, cnoid::OpenHRPControllerItem, cnoid::RootItem, cnoid::WorldItem, cnoid::PythonScriptItem, cnoid::PythonSimScriptItem, cnoid::GLVisionSimulatorItem, cnoid::SimulationScriptItem, cnoid::SimpleControllerItem, cnoid::MediaItem, cnoid::BodyMotionControllerItem, cnoid::BulletSimulatorItem, cnoid::OpenHRPClockGeneratorItem, cnoid::ExtCommandItem, cnoid::CollisionSeqItem, cnoid::SceneItem, cnoid::BodyTrackingCameraItem, cnoid::SensorVisualizerItem, cnoid::OpenHRPInterpreterServiceItem, cnoid::MultiDeviceStateSeqItem, cnoid::OpenHRPOnlineViewerItem, cnoid::SubSimulatorItem, cnoid::AbstractSeqItem, and cnoid::FolderItem.
|
inline |
bool Item::traverse | ( | boost::function< bool(Item *)> | function | ) |
|
inline |
|
inlineprotected |
|
friend |
|
friend |
|
friend |