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  CreationPanelFilter
 
class  FileFunction
 
class  FileFunctionBase
 

Public Types

enum  { PRIORITY_CONVERSION = -10, PRIORITY_COMPATIBILITY = 0, PRIORITY_OPTIONAL = 0, PRIORITY_DEFAULT = 10 }
 

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 >
void addCreationPanelPreFilter (const typename CreationPanelFilter< ItemType >::Function &filter)
 
template<class ItemType >
void addCreationPanelPostFilter (const typename CreationPanelFilter< ItemType >::Function &filter)
 
template<class ItemType >
ItemManagerregisterFileIO (ItemFileIO *fileIO)
 
template<class ItemType >
ItemManageraddLoader (const std::string &caption, const std::string &formatId, const std::string &extensions, const typename FileFunction< ItemType >::Function &function, int priority=PRIORITY_DEFAULT)
 
template<class ItemType >
ItemManageraddLoader (const std::string &caption, const std::string &formatId, std::function< std::string()> getExtensions, const typename FileFunction< ItemType >::Function &function, int priority=PRIORITY_DEFAULT)
 
template<class ItemType >
ItemManageraddSaver (const std::string &caption, const std::string &formatId, const std::string &extensions, const typename FileFunction< ItemType >::Function &function, int priority=PRIORITY_DEFAULT)
 
template<class ItemType >
ItemManageraddSaver (const std::string &caption, const std::string &formatId, std::function< std::string()> getExtensions, const typename FileFunction< ItemType >::Function &function, int priority=PRIORITY_DEFAULT)
 
template<class ItemType >
ItemManageraddLoaderAndSaver (const std::string &caption, const std::string &formatId, const std::string &extensions, const typename FileFunction< ItemType >::Function &loadingFunction, const typename FileFunction< ItemType >::Function &savingFunction, int priority=PRIORITY_DEFAULT)
 
template<class ItemType >
ItemManageraddLoaderAndSaver (const std::string &caption, const std::string &formatId, std::function< std::string()> getExtensions, const typename FileFunction< ItemType >::Function &loadingFunction, const typename FileFunction< ItemType >::Function &savingFunction, int priority=PRIORITY_DEFAULT)
 
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 &formatId)
 
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

◆ anonymous enum

anonymous enum
Enumerator
PRIORITY_CONVERSION 
PRIORITY_COMPATIBILITY 
PRIORITY_OPTIONAL 
PRIORITY_DEFAULT 

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

◆ addCreationPanelPostFilter()

template<class ItemType >
void cnoid::ItemManager::addCreationPanelPostFilter ( const typename CreationPanelFilter< ItemType >::Function &  filter)
inline

◆ addCreationPanelPreFilter()

template<class ItemType >
void cnoid::ItemManager::addCreationPanelPreFilter ( const typename CreationPanelFilter< ItemType >::Function &  filter)
inline

◆ addLoader() [1/2]

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

◆ addLoader() [2/2]

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

◆ addLoaderAndSaver() [1/2]

template<class ItemType >
ItemManager& cnoid::ItemManager::addLoaderAndSaver ( const std::string &  caption,
const std::string &  formatId,
const std::string &  extensions,
const typename FileFunction< ItemType >::Function &  loadingFunction,
const typename FileFunction< ItemType >::Function &  savingFunction,
int  priority = PRIORITY_DEFAULT 
)
inline

◆ addLoaderAndSaver() [2/2]

template<class ItemType >
ItemManager& cnoid::ItemManager::addLoaderAndSaver ( const std::string &  caption,
const std::string &  formatId,
std::function< std::string()>  getExtensions,
const typename FileFunction< ItemType >::Function &  loadingFunction,
const typename FileFunction< ItemType >::Function &  savingFunction,
int  priority = PRIORITY_DEFAULT 
)
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 &  formatId,
const std::string &  extensions,
const typename FileFunction< ItemType >::Function &  function,
int  priority = PRIORITY_DEFAULT 
)
inline

◆ addSaver() [2/2]

template<class ItemType >
ItemManager& cnoid::ItemManager::addSaver ( const std::string &  caption,
const std::string &  formatId,
std::function< std::string()>  getExtensions,
const typename FileFunction< ItemType >::Function &  function,
int  priority = PRIORITY_DEFAULT 
)
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 &  formatId 
)
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: