Dynamic lib selection and deployment
[anna.git] / include / anna / core / functions.hpp
index d43dcd0..0ceb358 100644 (file)
@@ -99,15 +99,25 @@ struct functions {
 
   /**
      \param number Numero a convertir.
-     @return Un literal con el numero convertido a cadena decimal.
+     @return Un literal con el numero sin signo convertido a cadena decimal.
   */
-  static std::string asString(const unsigned long number) throw();
+  static std::string asString(const unsigned int number) throw();
 
   /**
      \param number Numero a convertir.
      @return Un literal con el numero sin signo convertido a cadena decimal.
   */
-  static std::string asString(const unsigned int number) throw();
+  static std::string asString(const unsigned long long int number) throw() {
+    return asString((U64)number);
+  }
+
+  /**
+     \param number Numero a convertir.
+     @return Un literal con el numero sin signo convertido a cadena decimal.
+  */
+  static std::string asString(const long long int number) throw() {
+    return asString((S64)number);
+  }
 
   /**
      Devuelve un literal con tel numero convertido a cadena decimal
@@ -232,12 +242,6 @@ struct functions {
   */
   static std::string asHexString(const S64 number) throw();
 
-  /**
-     \param number Numero a convertir.
-     @return Un literal con el numero convertido a cadena hexadecimal.
-  */
-  static std::string asHexString(const long number) throw();
-
   /**
      \param number Numero a convertir.
      @return Un literal con el numero convertido a cadena hexadecimal.
@@ -616,34 +620,50 @@ struct functions {
   //////////////////////////////////////////////////////////////////////////////////////////////////
 
   /**
-     Pattern to obtain a component instance easily.
+     Pattern to obtain a multi named component instance easily.
      Parameters are usually replaced by the macro C <b>FILE_LOCATION</b>.
 
+     \param className Component class name
      \param fromFile File which called the method
      \param fromLine Line number within the file from where the method is called.
 
      \return Component instance for the class provided at the pattern
-     \warning The class T must define:
-     \code
-         static const char* getClassName () throw ();
-     \endcode
      \see Component
   */
-  template <typename T> static T* component(const char* fromFile, const int fromLine)
+  template <typename T> static T* componentByName(const char *className, const char* fromFile, const int fromLine)
   throw(RuntimeException) {
     ComponentManager &cm = ComponentManager::instantiate();
-    const char *className = T::getClassName();
     T* result = static_cast <T*>(cm.find(className));
 
     if(result == NULL) {
       std::string msg(className);
-      msg += " | Componente no registrado";
+      msg += " | Unregistered component";
       throw RuntimeException(msg, fromFile, fromLine);
     }
 
     return result;
   }
 
+  /**
+     Pattern to obtain a single named component instance easily.
+     Parameters are usually replaced by the macro C <b>FILE_LOCATION</b>.
+
+     \param fromFile File which called the method
+     \param fromLine Line number within the file from where the method is called.
+
+     \return Component instance for the class provided at the pattern
+     \warning T class must implement a method in the form:
+     \code
+         static const char* getClassName () throw ();
+     \endcode
+     \see Component
+  */
+  template <typename T> static T* component(const char* fromFile, const int fromLine)
+  throw(RuntimeException) {
+    return functions::componentByName<T> (T::getClassName(), fromFile, fromLine);
+  }
+
+
   /**
    * Gets exclusive hash for string provided on integer range
    *