Value.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_VALUE_H
00026 #define RCUCONF_VALUE_H
00027 #ifndef RCUCONF_TABLE_H
00028 # include <rcuconf/Table.h>
00029 #endif
00030 #ifndef __LIST__
00031 # include <list>
00032 #endif
00033 #include <iostream>
00034 
00035 namespace RcuDb 
00036 {
00037   class Result;
00038   class Row;
00039   class Sql;
00040 }
00041 
00042 namespace RcuConf 
00043 {
00044   
00050   class Value : public Table 
00051   {
00052   public:
00057     Value(int config, 
00058           int param, 
00059           int address) 
00060       : fConfigId(config), 
00061         fParamId(param), 
00062         fAddressId(address),
00063         fVersion(-1)
00064     {
00065       if (fAddressId > 0) std::cout << "Address=" << address << std::endl;
00066     }
00068     virtual ~Value() { }
00069 
00071     typedef std::list<Value*> List;
00072     
00074     virtual void Print() const;
00075 
00077     int ConfigId() const { return fConfigId; }
00079     int ParamId() const { return fParamId; }
00081     int AddressId() const { return fAddressId; }
00083     int Version() const { return fVersion; }
00084 
00091     static bool Select(List& r, RcuDb::Server& s, 
00092                        const std::string& table, const RcuDb::Sql& cond);
00093     
00106     static bool Select(List& r, RcuDb::Server& s, 
00107                        const std::string& table, int config, int param,
00108                        int addr=-1);
00109   protected:
00116     static bool Select(RcuDb::Result*& r, RcuDb::Server& s, 
00117                        const std::string& table, const RcuDb::Sql& cond);
00130     static bool Select(RcuDb::Result*& r, RcuDb::Server& s, 
00131                        const std::string& table, int config, int param,
00132                        int addr=-1);
00133 
00137     RcuDb::Sql& ValueInsert(RcuDb::Sql& sql);
00138     
00142     static RcuDb::Sql& ValueCreate(RcuDb::Sql& sql);
00143 
00146     Value(RcuDb::Row& row);
00148     int fConfigId;
00150     int fParamId;
00152     int fAddressId;
00154     int fVersion;
00155   };
00156 }
00157 
00158 #endif
00159 //
00160 // EOF
00161 //
00162 
00163   
00164 
Top of page Last update Fri Apr 27 01:54:16 2007
Copyright © 2004 Christian Holm Created by DoxyGen 1.3.5