Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] View of /trunk/gadget/hasname.h
[mareframe] / trunk / gadget / hasname.h Repository:
ViewVC logotype

View of /trunk/gadget/hasname.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (download) (annotate)
Mon Feb 10 17:09:07 2014 UTC (10 years, 3 months ago) by agomez
File size: 997 byte(s)
Initial version based on Gadget 2.2.00
#ifndef hasname_h
#define hasname_h

#include "gadget.h"

/**
 * \class HasName
 * \brief This is the base class for any object that has a name
 */
class HasName {
public:
  /**
   * \brief This is the default HasName constructor
   */
  HasName() { name = new char[1]; name[0] = '\0'; };
  /**
   * \brief This is the default HasName destructor
   * \note This will free all the memory allocated
   */
  virtual ~HasName() { delete[] name; };
  /**
   * \brief This is the HasName constructor for a specified name
   * \param givenname is a text string containing the name of the object to be created
   */
  HasName(const char* givenname) {
    name = new char[strlen(givenname) + 1];
    strcpy(name, givenname);
  };
  /**
   * \brief This will return a null terminated text string containing the name of the object
   * \return name
   */
  const char* getName() const { return name; };
private:
  /**
   * \brief This is the null terminated name of the object
   */
  char* name;
};

#endif

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge