X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;ds=sidebyside;f=include%2Fanna%2Fcore%2FSingleton.hpp;h=cd92e2dd02361042418868db0f735add7b59db40;hb=1b238ab9e7ece2279ea37f4cb642f13501b26721;hp=897f0c001cac4c991dd9ee7586d18669cad18a2b;hpb=4e12ac57e93c052f716a6305ad8fc099c45899d1;p=anna.git
diff --git a/include/anna/core/Singleton.hpp b/include/anna/core/Singleton.hpp
index 897f0c0..cd92e2d 100644
--- a/include/anna/core/Singleton.hpp
+++ b/include/anna/core/Singleton.hpp
@@ -1,8 +1,8 @@
-// ANNA - Anna is Not 'N' Anymore
+// ANNA - Anna is Not Nothingness Anymore
//
// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo
//
-// https://bitbucket.org/testillano/anna
+// http://redmine.teslayout.com/projects/anna-suite
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
@@ -14,7 +14,7 @@
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
-// * Neither the name of Google Inc. nor the names of its
+// * Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
@@ -45,14 +45,13 @@
namespace anna {
/**
- Patrn Singleton. Limita la utilizacin de una determinada clase
- para que slo pueda existir una nica instancia.
+ Singleton pattern. Limits the use to a unique class instance.
- El contructor por defecto de la clase T debe ser privado, para evitar que
- esta clase se pueda instanciar desde el exterior.
- Vamos a ver un ejemplo de como se haria un Singleton sobre la clase A.
+ Default constructor for T must be private in order to avoid
+ external instantiation. Following, an example using class A:
- En el archivo de cabecera de la clase A tendriamos:
+
+ On A class header file, we will have:
\code
...
@@ -62,21 +61,21 @@ namespace anna {
class A : public anna::Singleton {
public:
- // Accesores
- int obtenerDato () const { return a_unDato; }
+ // getters
+ int getData () const { return a_data; }
- // Modificadores
- void establecerOtroDato (const ASD& otroDato) { a_otroDato = otroDato; }
+ // setters
+ void setOtherData (const ASD& otherData) { a_otherData = otherData; }
- // Operadores
+ // operators
....
- // Metodos
+ // methods
...
private:
- int a_unDato;
- ASD a_otroDato;
+ int a_data;
+ ASD a_otherData;
A ();
@@ -85,7 +84,7 @@ namespace anna {
\endcode
- Para hacer uso de la clase A:
+ To use A class:
\code
#include
@@ -93,11 +92,11 @@ namespace anna {
...
...
- void CualquierClase::cualquierFuncion () throw (RuntimeException)
+ void anyClass::anyFunction () throw (RuntimeException)
{
A& a (A::instantiate ());
- cout << a.obtenerDato () << endl;
+ cout << a.getData () << endl;
}
\endcode
@@ -105,14 +104,14 @@ namespace anna {
template class Singleton {
public:
/**
- @return La instancia de la clase indicada en la creacin de la template.
+ @return Class instance provided on template creation.
*/
static T& instantiate() { return *alloc(true); }
/**
- Libera la instancia de la clase indicada en la creacin de esta template.
- Si no hay creada ninguna instancia simplemente se ignora. Este m�odo
- slo deber� invocarse justo antes de la terminacin de nuestro programa.
+ Release the class instance provided in this template creation.
+ If no instance has been created, this will be ignored.
+ This method only have to be used during the program termination.
*/
static void release() { alloc(false); }