Choreonoid  1.8
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
cnoid::ItemManager Class Reference

#include <ItemManager.h>

Classes

class  FileFunction
 
class  FileFunctionBase
 

Public Types

enum  IoUsageType {
  Standard = 10, Conversion = 0, Internal = -10, PRIORITY_DEFAULT = Standard,
  PRIORITY_COMPATIBILITY = Internal, PRIORITY_OPTIONAL = Internal, PRIORITY_CONVERSION = Conversion
}
 

Public Member Functions

 ItemManager (const std::string &moduleName, MenuManager &menuManager)
 
 ~ItemManager ()
 
void detachAllManagedTypeItemsFromRoot ()
 
void bindTextDomain (const std::string &domain)
 
template<class ItemType , class SuperItemType = Item>
ItemManagerregisterClass (const std::string &className)
 
template<class ItemType , class SuperItemType = Item>
ItemManagerregisterClass (const std::string &className, ItemType *singletonInstance)
 This function registers a singleton item class. More...
 
template<class ItemType , class SuperItemType = Item>
ItemManagerregisterAbstractClass ()
 
template<class ItemType >
ItemManageraddAlias (const std::string &className, const std::string &moduleName)
 
template<class ItemType >
ItemManageraddCreationPanel (ItemCreationPanel *panel=nullptr)
 
template<class ItemType >
ItemManageraddFileIO (ItemFileIO *fileIO)
 
template<class ItemType >
ItemManagerregisterFileIO (ItemFileIO *fileIO)
 
template<class ItemType >
ItemManageraddLoader (const std::string &caption, const std::string &format, const std::string &extensions, typename FileFunction< ItemType >::Function function, int usage=Standard)
 
template<class ItemType >
ItemManageraddLoader (const std::string &caption, const std::string &format, std::function< std::string()> getExtensions, typename FileFunction< ItemType >::Function function, int usage=Standard)
 
template<class ItemType >
ItemManageraddSaver (const std::string &caption, const std::string &format, const std::string &extensions, typename FileFunction< ItemType >::Function function, int usage=Standard)
 
template<class ItemType >
ItemManageraddSaver (const std::string &caption, const std::string &format, std::function< std::string()> getExtensions, typename FileFunction< ItemType >::Function function, int usage=Standard)
 
template<class ItemType >
ItemManageraddLoaderAndSaver (const std::string &caption, const std::string &format, const std::string &extensions, typename FileFunction< ItemType >::Function loaderFunction, typename FileFunction< ItemType >::Function saverFunction, int usage=Standard)
 
template<class ItemType >
ItemManageraddLoaderAndSaver (const std::string &caption, const std::string &format, std::function< std::string()> getExtensions, typename FileFunction< ItemType >::Function loaderFunction, typename FileFunction< ItemType >::Function saverFunction, int usage=Standard)
 
void addMenuItemToImport (const std::string &caption, std::function< void()> slot)
 
template<class AddonType >
void registerAddon (const std::string &name, std::function< ItemAddon *(void)> factory=nullptr)
 

Static Public Member Functions

static bool getClassIdentifier (Item *item, std::string &out_moduleName, std::string &out_className)
 
template<class ItemType >
static ItemType * singletonInstance ()
 
template<class ItemType >
static std::vector< ItemFileIO * > getFileIOs ()
 
static std::vector< ItemFileIO * > getFileIOs (const std::type_info &type)
 
static ItemFileIOfindFileIO (const std::type_info &type, const std::string &format)
 
static ItemcreateItem (const std::string &moduleName, const std::string &itemClassName)
 
static ItemcreateItem (int itemClassId)
 
template<class ItemType >
static ItemType * createItemWithDialog (Item *parentItem, bool doAddition=true, Item *nextItem=nullptr, Item *protoItem=nullptr, const std::string &title=std::string())
 
template<class ItemType >
static ItemList< ItemType > loadItemsWithDialog (Item *parentItem, bool doAddtion=true, Item *nextItem=nullptr)
 
template<class ItemType >
static bool saveItemWithDialog (ItemType *item)
 
static void reloadItems (const ItemList<> &items)
 
static ItemfindOriginalItemForReloadedItem (Item *item)
 
static ItemAddoncreateAddon (const std::type_info &type)
 
static ItemAddoncreateAddon (const std::string &moduleName, const std::string &addonName)
 
static bool getAddonIdentifier (ItemAddon *addon, std::string &out_moduleName, std::string &out_addonName)
 

Friends

class Item
 

Member Enumeration Documentation

◆ IoUsageType

Enumerator
Standard 
Conversion 
Internal 
PRIORITY_DEFAULT 
PRIORITY_COMPATIBILITY 
PRIORITY_OPTIONAL 
PRIORITY_CONVERSION 

Constructor & Destructor Documentation

◆ ItemManager()

ItemManager::ItemManager ( const std::string &  moduleName,
MenuManager menuManager 
)

◆ ~ItemManager()

ItemManager::~ItemManager ( )

Member Function Documentation

◆ addAlias()

template<class ItemType >
ItemManager& cnoid::ItemManager::addAlias ( const std::string &  className,
const std::string &  moduleName 
)
inline

◆ addCreationPanel()

template<class ItemType >
ItemManager& cnoid::ItemManager::addCreationPanel ( ItemCreationPanel panel = nullptr)
inline

◆ addFileIO()

template<class ItemType >
ItemManager& cnoid::ItemManager::addFileIO ( ItemFileIO fileIO)
inline

◆ addLoader() [1/2]

template<class ItemType >
ItemManager& cnoid::ItemManager::addLoader ( const std::string &  caption,
const std::string &  format,
const std::string &  extensions,
typename FileFunction< ItemType >::Function  function,
int  usage = Standard 
)
inline

◆ addLoader() [2/2]

template<class ItemType >
ItemManager& cnoid::ItemManager::addLoader ( const std::string &  caption,
const std::string &  format,
std::function< std::string()>  getExtensions,
typename FileFunction< ItemType >::Function  function,
int  usage = Standard 
)
inline

◆ addLoaderAndSaver() [1/2]

template<class ItemType >
ItemManager& cnoid::ItemManager::addLoaderAndSaver ( const std::string &  caption,
const std::string &  format,
const std::string &  extensions,
typename FileFunction< ItemType >::Function  loaderFunction,
typename FileFunction< ItemType >::Function  saverFunction,
int  usage = Standard 
)
inline

◆ addLoaderAndSaver() [2/2]

template<class ItemType >
ItemManager& cnoid::ItemManager::addLoaderAndSaver ( const std::string &  caption,
const std::string &  format,
std::function< std::string()>  getExtensions,
typename FileFunction< ItemType >::Function  loaderFunction,
typename FileFunction< ItemType >::Function  saverFunction,
int  usage = Standard 
)
inline

◆ addMenuItemToImport()

void ItemManager::addMenuItemToImport ( const std::string &  caption,
std::function< void()>  slot 
)

◆ addSaver() [1/2]

template<class ItemType >
ItemManager& cnoid::ItemManager::addSaver ( const std::string &  caption,
const std::string &  format,
const std::string &  extensions,
typename FileFunction< ItemType >::Function  function,
int  usage = Standard 
)
inline

◆ addSaver() [2/2]

template<class ItemType >
ItemManager& cnoid::ItemManager::addSaver ( const std::string &  caption,
const std::string &  format,
std::function< std::string()>  getExtensions,
typename FileFunction< ItemType >::Function  function,
int  usage = Standard 
)
inline

◆ bindTextDomain()

void ItemManager::bindTextDomain ( const std::string &  domain)

◆ createAddon() [1/2]

ItemAddon * ItemManager::createAddon ( const std::string &  moduleName,
const std::string &  addonName 
)
static

◆ createAddon() [2/2]

ItemAddon * ItemManager::createAddon ( const std::type_info &  type)
static

◆ createItem() [1/2]

Item * ItemManager::createItem ( const std::string &  moduleName,
const std::string &  itemClassName 
)
static

◆ createItem() [2/2]

Item * ItemManager::createItem ( int  itemClassId)
static

◆ createItemWithDialog()

template<class ItemType >
static ItemType* cnoid::ItemManager::createItemWithDialog ( Item parentItem,
bool  doAddition = true,
Item nextItem = nullptr,
Item protoItem = nullptr,
const std::string &  title = std::string() 
)
inlinestatic

Create a new item interactively using the corresponding dialog

Parameters
parentItemThe item that will be a parent of the new item.
doAdditionThe created item is actually added to the parent item if this flag is true.
nextItemThe position to insert the created item can be specifid by this parameter.
protoItemThe prototype item instance for creating a new item. If this parameter is omitted, the default prototype item is used.
titleThe dialog title string

◆ detachAllManagedTypeItemsFromRoot()

void ItemManager::detachAllManagedTypeItemsFromRoot ( )

◆ findFileIO()

ItemFileIO * ItemManager::findFileIO ( const std::type_info &  type,
const std::string &  format 
)
static

◆ findOriginalItemForReloadedItem()

Item * ItemManager::findOriginalItemForReloadedItem ( Item item)
static

◆ getAddonIdentifier()

bool ItemManager::getAddonIdentifier ( ItemAddon addon,
std::string &  out_moduleName,
std::string &  out_addonName 
)
static

◆ getClassIdentifier()

bool ItemManager::getClassIdentifier ( Item item,
std::string &  out_moduleName,
std::string &  out_className 
)
static

◆ getFileIOs() [1/2]

template<class ItemType >
static std::vector<ItemFileIO*> cnoid::ItemManager::getFileIOs ( )
inlinestatic

◆ getFileIOs() [2/2]

vector< ItemFileIO * > ItemManager::getFileIOs ( const std::type_info &  type)
static

◆ loadItemsWithDialog()

template<class ItemType >
static ItemList<ItemType> cnoid::ItemManager::loadItemsWithDialog ( Item parentItem,
bool  doAddtion = true,
Item nextItem = nullptr 
)
inlinestatic

◆ registerAbstractClass()

template<class ItemType , class SuperItemType = Item>
ItemManager& cnoid::ItemManager::registerAbstractClass ( )
inline

◆ registerAddon()

template<class AddonType >
void cnoid::ItemManager::registerAddon ( const std::string &  name,
std::function< ItemAddon *(void)>  factory = nullptr 
)
inline

◆ registerClass() [1/2]

template<class ItemType , class SuperItemType = Item>
ItemManager& cnoid::ItemManager::registerClass ( const std::string &  className)
inline

◆ registerClass() [2/2]

template<class ItemType , class SuperItemType = Item>
ItemManager& cnoid::ItemManager::registerClass ( const std::string &  className,
ItemType *  singletonInstance 
)
inline

This function registers a singleton item class.

◆ registerFileIO()

template<class ItemType >
ItemManager& cnoid::ItemManager::registerFileIO ( ItemFileIO fileIO)
inline

◆ reloadItems()

void ItemManager::reloadItems ( const ItemList<> &  items)
static

◆ saveItemWithDialog()

template<class ItemType >
static bool cnoid::ItemManager::saveItemWithDialog ( ItemType *  item)
inlinestatic

◆ singletonInstance()

template<class ItemType >
static ItemType* cnoid::ItemManager::singletonInstance ( )
inlinestatic

Friends And Related Function Documentation

◆ Item

friend class Item
friend

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