Changeset 16 in pacpusframework


Ignore:
Timestamp:
Jan 8, 2013, 1:51:02 AM (12 years ago)
Author:
sgosseli
Message:

Passage by const-reference instead of value.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/Pacpus/kernel/ComponentManager.h

    r14 r16  
    6666     * @return Number of components loaded by the manager.
    6767     */
    68     PACPUSLIB_API std::size_t loadComponents(QString file);
     68    PACPUSLIB_API std::size_t loadComponents(const QString& file);
    6969
    7070    /** Start all the components
     
    7777     * @return True if the component exists and has been started, otherwise false.
    7878     */
    79     PACPUSLIB_API int start(QString component);
     79    PACPUSLIB_API int start(const QString& component);
    8080
    8181    /** Stop all the components
     
    8888     * @return True if the component has been stopped, otherwise false.
    8989     */
    90     PACPUSLIB_API int stop(QString component);
     90    PACPUSLIB_API int stop(const QString& component);
    9191
    9292    /** Get a pointer to the component referred by @em name.
     
    9494     * @return Pointer to the component if it exists, otherwise @em NULL.
    9595     */
    96     PACPUSLIB_API ComponentBase* getComponent(QString name);
     96    PACPUSLIB_API ComponentBase* getComponent(const QString& name);
    9797
    9898    /** Get the list of all the names of the component known by the manager.
     
    105105     * @return True if the plugin has been loaded, otherwise false.
    106106     */
    107     PACPUSLIB_API bool loadPlugin(QString filename);
     107    PACPUSLIB_API bool loadPlugin(const QString& filename);
    108108
    109109private:
    110110    /// Create a new component of type 'type' and with the name 'name'
    111     bool createComponent(QString type, QString name);
     111    bool createComponent(const QString& type, const QString& name);
    112112
    113     bool registerComponent(ComponentBase * addr, QString name);
    114     bool registerComponentFactory(ComponentFactoryBase * addr, QString type);
     113    bool registerComponent(ComponentBase* addr, const QString& name);
     114    bool registerComponentFactory(ComponentFactoryBase* addr, const QString& type);
    115115
    116     bool unRegisterComponent(QString name);
    117     bool unRegisterComponentFactory(QString type);
     116    bool unRegisterComponent(const QString& name);
     117    bool unRegisterComponentFactory(const QString& type);
    118118
    119119    // Allow 2 functions to access to private members of ComponentManager
    120     friend void ComponentFactoryBase::addFactory(ComponentFactoryBase * addr, const QString & type);
     120    friend void ComponentFactoryBase::addFactory(ComponentFactoryBase* addr, const QString & type);
    121121    friend void ComponentFactoryBase::addComponent(const QString & name);
    122122
  • trunk/src/PacpusLib/ComponentManager.cpp

    r15 r16  
    5454}
    5555
    56 bool ComponentManager::registerComponentFactory(ComponentFactoryBase * addr, QString type)
     56bool ComponentManager::registerComponentFactory(ComponentFactoryBase* addr, const QString& type)
    5757{
    5858    LOG_TRACE("registerComponentFactory(type="<< type << ")");
     
    7171}
    7272
    73 bool ComponentManager::unRegisterComponentFactory(QString type)
     73bool ComponentManager::unRegisterComponentFactory(const QString& type)
    7474{
    7575    LOG_TRACE("unRegisterComponentFactory(type="<< type << ")");
     
    8787}
    8888
    89 bool ComponentManager::registerComponent(ComponentBase * addr, QString name)
     89bool ComponentManager::registerComponent(ComponentBase* addr, const QString& name)
    9090{
    9191    LOG_TRACE("registerComponent(name="<< name << ")");
     
    103103}
    104104
    105 bool ComponentManager::unRegisterComponent(QString name)
     105bool ComponentManager::unRegisterComponent(const QString& name)
    106106{
    107107    LOG_TRACE("unRegisterComponent(name="<< name << ")");
     
    121121}
    122122
    123 bool ComponentManager::createComponent(QString type, QString name)
     123bool ComponentManager::createComponent(const QString& type, const QString& name)
    124124{
    125125    LOG_TRACE("createComponent(type=" << type << ", " << "name="<< name << ")");
     
    136136}
    137137
    138 bool ComponentManager::loadPlugin(QString filename)
     138bool ComponentManager::loadPlugin(const QString& filename)
    139139{
    140140    LOG_TRACE("loadPlugin(filename=" << filename << ")");
     
    163163}
    164164
    165 std::size_t ComponentManager::loadComponents(QString configFilename)
     165std::size_t ComponentManager::loadComponents(const QString& configFilename)
    166166{
    167167    LOG_TRACE("loadComponents(filename=" << configFilename << ")");
     
    265265}
    266266
    267 int ComponentManager::start(QString componentName)
     267int ComponentManager::start(const QString& componentName)
    268268{
    269269    LOG_TRACE("start(component=" << componentName << ")");
     
    297297}
    298298
    299 int ComponentManager::stop(QString componentName)
     299int ComponentManager::stop(const QString& componentName)
    300300{
    301301    LOG_TRACE("stop(component=" << componentName << ")");
     
    318318}
    319319
    320 ComponentBase * ComponentManager::getComponent(QString name)
     320ComponentBase* ComponentManager::getComponent(const QString& name)
    321321{
    322322    LOG_TRACE("getComponent(name=" << name << ")");
Note: See TracChangeset for help on using the changeset viewer.