Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

Scalar.h

Go to the documentation of this file.
00001 
00002 //
00003 // This file is part of the MADELINE 2 program 
00004 // written by Edward H. Trager, Ritu Khanna and Adrian Marrs
00005 // Copyright (c) 2005 by the
00006 // Regents of the University of Michigan.
00007 // All Rights Reserved.
00008 // 
00009 // The latest version of this program is available from:
00010 // 
00011 //   http://eyegene.ophthy.med.umich.edu/madeline/
00012 //   
00013 // Released under the GNU General Public License.
00014 // A copy of the GPL is included in the distribution
00015 // package of this software, or see:
00016 // 
00017 //   http://www.gnu.org/copyleft/
00018 //   
00019 // ... for licensing details.
00020 // 
00022 //
00023 // 2005.07.17.RK.ET
00024 //
00025 
00026 #ifndef SCALAR_INCLUDED
00027 #define SCALAR_INCLUDED
00028 
00029 #include "Variable.h"
00031 
00034 class Scalar : public Variable{
00035 private:
00037         Data* _val;
00038         
00039 public:
00040         //
00041         // Constructors/Destructors:
00042         //
00043         Scalar(const std::string & name) : Variable(name) { }
00044         Scalar(const std::string & name,const short valueType,const std::string & value) : Variable(name,valueType){ if(valueType != ANY) set(valueType,value);}
00045         
00046         ~Scalar(){ 
00047                 if(_valueType != ANY) delete _val;
00048         }
00049         // Copy Constructor:
00050         Scalar(const Scalar& s) : Variable(s._name,s._valueType),_val(s._val->clone()) { }
00051         
00052         //
00053         // Assignment Operator:
00054         //
00055         Scalar& operator= (const Scalar& s);
00056         //
00057         // Methods required by Variable virtual base class:
00058         //
00059         const std::string get( void ) const;
00060         const std::string getValueType() const;
00061         const std::string getVariableType() const { return "Scalar"; }
00062         
00063         //
00064         // Additional methods not present in the virtual base class:
00065         //
00066         void set(const short valueType,const std::string value);
00067         
00068         //
00069         // Friend functions:
00070         //
00071         friend bool operator==(const Scalar& a, const Scalar& b);
00072         friend bool operator<(const Scalar& a,const Scalar& b);
00073         
00074 };
00075 
00076         std::ostream& operator<<(std::ostream& out,const Scalar& var);
00077 
00078 #endif
00079 

Generated on Fri Nov 18 16:24:39 2011 for MADELINE by  doxygen 1.4.4