db.hpp

См. документацию.
00001 /*
00002 
00003 Copyright (c) 2002-2005, Yauheni Akhotnikau
00004 All rights reserved.
00005 
00006 Redistribution and use in source and binary forms, with or without
00007 modification, are permitted provided that the following conditions are met:
00008 
00009 - Redistributions of source code must retain the above copyright notice, this
00010 list of conditions and the following disclaimer.
00011 
00012 - Redistributions in binary form must reproduce the above copyright notice, this
00013 list of conditions and the following disclaimer in the documentation and/or
00014 other materials provided with the distribution.
00015 
00016 - The name of the author may not be used to endorse or promote products derived
00017 from this software without specific prior written permission.
00018 
00019 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00020 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00021 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
00022 EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00024 OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00027 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00028 OF SUCH DAMAGE.
00029 
00030 */
00031 
00038 #if !defined( _OESS_1__DB__CLN__DB_HPP_ )
00039 #define _OESS_1__DB__CLN__DB_HPP_
00040 
00041 #include <set>
00042 
00043 #include <oess_1/db/h/declspec.hpp>
00044 
00045 #include <auto_ptr_3/h/obj_ptr.hpp>
00046 
00047 #include <oess_1/defs/h/ent_id.hpp>
00048 
00049 #include <oess_1/io/h/binstream.hpp>
00050 
00051 #include <oess_1/stdsn/h/serializable.hpp>
00052 
00053 #include <oess_1/db/site/h/abstract_connector.hpp>
00054 
00055 namespace oess_1 {
00056 
00057 namespace db {
00058 
00059 namespace cln {
00060 
00061 //
00062 // db_t
00063 //
00064 
00069 class OESS_1__DB__TYPE  db_t
00070 {
00071   friend class transaction_t;
00072   public :
00073     db_t(
00077       oess_1::db::site::abstract_connector_t * connector );
00078     virtual ~db_t();
00079 
00081     virtual void
00082     attach(
00084       const std::string & logic_name ) = 0;
00085 
00087     virtual void
00088     detach() = 0;
00089 
00090     virtual oess_1::db::site::abstract_connector_t &
00091     query_connector();
00092 
00093     virtual const oess_1::db::site::abstract_connector_t &
00094     query_connector() const;
00095 
00097 
00099 
00100 
00105     virtual void
00106     slice_create(
00108       const std::string & name ) = 0;
00109 
00111 
00114     virtual void
00115     slice_destroy(
00117       const std::string & name ) = 0;
00118 
00120 
00124     virtual bool
00125     slice_is_exists(
00127       const std::string & name ) = 0;
00128 
00130 
00133     virtual std::set< std::string >
00134     slice_names() = 0;
00135 
00138 
00139 
00141 
00142 
00143     virtual oess_1::ent_id_t
00144     ent_create(
00146       const std::string & slice_name,
00148       const oess_1::stdsn::serializable_t & ent ) = 0;
00149 
00151     virtual void
00152     ent_destroy(
00154       const oess_1::ent_id_t & ent_id ) = 0;
00155 
00157 
00160     virtual void
00161     ent_destroy_all(
00163       const std::string & slice_name ) = 0;
00164 
00166 
00170     virtual void
00171     ent_load(
00173       const oess_1::ent_id_t & ent_id,
00175       oess_1::stdsn::serializable_t & ent ) = 0;
00176 
00178     virtual void
00179     ent_update(
00181       const oess_1::ent_id_t & ent_id,
00183       const oess_1::stdsn::serializable_t & ent ) = 0;
00184 
00187 
00197     virtual oess_1::ent_id_t
00198     ent_find_next(
00200       const std::string & slice_name,
00202       const oess_1::ent_id_t & ent_id ) = 0;
00211 
00212 
00216     virtual oess_1::ent_id_t
00217     ent_raw_create(
00219       const std::string & slice_name,
00221       oess_1::io::ibinstream_t & image,
00223       oess_1::uint_t image_size ) = 0;
00224 
00226 
00230     virtual oess_1::uint_t
00231     ent_raw_load(
00233       const oess_1::ent_id_t & ent_id,
00235       oess_1::io::obinstream_t & to,
00242       oess_1::uint_t length_limit =
00243           static_cast< oess_1::uint_t >( -1 ) ) = 0;
00244 
00246 
00249     virtual void
00250     ent_raw_update(
00252       const oess_1::ent_id_t & ent_id,
00254       oess_1::io::ibinstream_t & image,
00256       oess_1::uint_t image_size ) = 0;
00259   protected :
00261 
00262     virtual void
00263     transaction_begin() = 0;
00264 
00266 
00267     virtual void
00268     transaction_commit() = 0;
00269 
00271 
00272     virtual void
00273     transaction_rollback() = 0;
00274 
00275   private :
00277     auto_ptr_3::obj_ptr_t<
00278       oess_1::db::site::abstract_connector_t >
00279       m_connector_ptr;
00280 
00281   
00282     db_t( const db_t & );
00283     db_t &
00284     operator=( const db_t & );
00285 };
00286 
00287 //
00288 // create_std_db
00289 //
00290 
00298 OESS_1__DB__FUNC(db_t *)
00299 create_std_db(
00303   oess_1::db::site::abstract_connector_t * connector );
00304 
00305 //
00306 // transaction_t
00307 //
00308 
00310 
00352 class OESS_1__DB__TYPE  transaction_t
00353 {
00355   db_t &  m_db;
00357   bool  m_is_finished;
00360   std::ostream *  m_errs;
00361 
00362 public :
00363   transaction_t( db_t & db,
00364     std::ostream * errs = 0 );
00365   ~transaction_t();
00366 
00368 
00370   void
00371   commit();
00372 };
00373 
00374 } /* namespace cln */
00375 
00376 } /* namespace db */
00377 
00378 } /* namespace oess_1 */
00379 
00380 #endif

Документация по ObjESSty. Последние изменения: Fri Oct 13 18:35:35 2006. Создано системой  doxygen 1.4.7
Hosted by uCoz