vectorinterface.h

Go to the documentation of this file.
00001 #ifndef  __VectorInterface_h
00002 #define  __VectorInterface_h
00003 
00004 #include  <string>
00005 #include  <iostream>
00006 #include  <cassert>
00007 
00008 
00009 namespace Gascoigne
00010 {
00011 
00019 
00020   class VectorInterface : public std::string
00021   {
00022     private:
00023       std::string _type;
00024 
00025     protected:
00026 
00027     public:
00028       VectorInterface(const std::string& name) : std::string(name), _type("node")  { }
00029       VectorInterface(const std::string& name, const std::string& type) : std::string(name) {
00030         assert(type=="node" || type=="cell");
00031         GetType()=type;
00032       }
00033       VectorInterface(const VectorInterface& v) {
00034         SetName(v.GetName());
00035         SetType(v.GetType());
00036       }
00037       virtual ~VectorInterface() { }
00038 
00039       void SetName(const std::string& name) { GetName()=name; }
00040       std::string& GetName() { return *this; }
00041       const std::string& GetName() const { return *this; }
00042 
00043       void SetType(const std::string& type) { GetType()=type; }
00044       std::string& GetType() { return _type; }
00045       const std::string& GetType() const { return _type; }
00046 
00047       friend std::ostream& operator<<(std::ostream& os, const VectorInterface& g) {
00048         os << "Name: '" << g.GetName() << "' ";
00049         os << "Type: '" << g.GetType() << "'" << std::endl;
00050         return os;
00051       }
00052 
00053   };
00054 }
00055 
00056 #endif

Generated on Thu Sep 14 10:34:36 2006 for Gascoigne by  doxygen 1.4.7