Parameter.h

Go to the documentation of this file.
00001 // -*- mode: C++ -*- 
00002 //
00003 // Copyright (C) 2006 Christian Holm Christensen <cholm@nbi.dk>
00004 //
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public License
00007 // as published by the Free Software Foundation; either version 2.1
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free
00017 // Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018 // 02111-1307 USA
00019 //
00025 #ifndef RCUCONF_PARAMETER_H
00026 #define RCUCONF_PARAMETER_H
00027 #ifndef RCUCONF_TABLE_H
00028 # include <rcuconf/Table.h>
00029 #endif
00030 #ifndef __LIST__
00031 # include <list>
00032 #endif
00033 
00034 namespace RcuDb 
00035 {
00036   class Result;
00037   class Row;
00038   class Sql;
00039 }
00040 namespace RcuConf
00041 {
00042   
00048   class Parameter : public Table 
00049   {
00050   public:
00052     enum Where {
00054       kRcu, 
00056       kBc, 
00058       kAltro, 
00060       kInvalid
00061     };
00062 
00068     Parameter(const std::string& name, 
00069               Where              dest,
00070               bool               isBlob, 
00071               unsigned int       mask) 
00072       : fName(name), 
00073         fDestination(dest), 
00074         fIsBlob(isBlob),
00075         fMask(mask)
00076     {}
00078     virtual ~Parameter() {}
00080     typedef std::list<Parameter*> List;
00081 
00083     virtual void Print() const;
00086     virtual bool Insert(RcuDb::Server& s);
00089     static  bool Create(RcuDb::Server& s);
00092     static  bool Drop(RcuDb::Server& s);
00098     static  bool Select(List& l, RcuDb::Server& s, const RcuDb::Sql& cond);
00105     static  bool Select(List& l, RcuDb::Server& s, Where w, 
00106                         const std::string& name=std::string());
00107 
00109     const std::string& Name() const { return fName; }
00111     Where Destination() const { return fDestination; }
00113     bool IsBlob() const { return fIsBlob; }
00115     unsigned int Mask() const { return fMask; }
00116 
00118     static const std::string fgName;
00119   protected:
00122     Parameter(RcuDb::Row& row);
00124     std::string fName;
00126     Where fDestination;
00128     bool fIsBlob;
00130     unsigned int fMask;
00131   };
00136   std::ostream& operator<<(std::ostream& o, const Parameter::Where w);
00141   std::istream& operator>>(std::istream& i, Parameter::Where& w);
00142 }
00143 #endif
00144 //
00145 // EOF
00146 //
00147 
Top of page Last update Fri Apr 27 01:54:15 2007
Copyright © 2004 Christian Holm Created by DoxyGen 1.3.5