CVR-Lib last update 20 Sep 2009

cvrIoObject.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1998
00003  * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany
00004  *
00005  *
00006  * This file is part of the Computer Vision and Robotics Library (CVR-Lib)
00007  *
00008  * The CVR-Lib is free software; you can redistribute it and/or
00009  * modify it under the terms of the BSD License.
00010  *
00011  * All rights reserved.
00012  *
00013  * Redistribution and use in source and binary forms, with or without
00014  * modification, are permitted provided that the following conditions are met:
00015  *
00016  * 1. Redistributions of source code must retain the above copyright notice,
00017  *    this list of conditions and the following disclaimer.
00018  *
00019  * 2. Redistributions in binary form must reproduce the above copyright notice,
00020  *    this list of conditions and the following disclaimer in the documentation
00021  *    and/or other materials provided with the distribution.
00022  *
00023  * 3. Neither the name of the authors nor the names of its contributors may be
00024  *    used to endorse or promote products derived from this software without
00025  *    specific prior written permission.
00026  *
00027  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00028  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00029  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00030  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00031  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00032  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00033  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00034  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00035  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00036  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00037  * POSSIBILITY OF SUCH DAMAGE.
00038  */
00039 
00040 
00041 
00042 /**
00043  * \file   cvrIoObject.h
00044  *         Containes base class for all serializable classes
00045  * \author Benjamin Winkler
00046  * \date   14.12.2001
00047  *
00048  * $Id: cvrIoObject.h,v 1.5 2006/01/07 22:19:09 alvarado Exp $
00049  */
00050 
00051 #ifndef _CVR_IO_OBJECT_H_
00052 #define _CVR_IO_OBJECT_H_
00053 
00054 #include "cvrObject.h"
00055 #include "cvrIoHandler.h"
00056 
00057 namespace cvr {
00058 
00059   /**
00060    * Basic input/output class for data objects.
00061    *
00062    * This is an abstract class.
00063    *
00064    * @ingroup gStorable
00065    */
00066   class ioObject : public object {
00067   public:
00068 
00069     /**
00070      * Default constructor
00071      */
00072     ioObject();
00073 
00074     /**
00075      * Destructor
00076      */
00077     virtual ~ioObject();
00078 
00079     /**
00080      * Returns the name of this class
00081      */
00082     virtual const std::string& name() const = 0;
00083 
00084     /**
00085      * Returns a copy of this object
00086      */
00087     virtual ioObject* clone() const = 0;
00088 
00089     /**
00090      * Returns a copy of this object
00091      */
00092     virtual ioObject* newInstance() const = 0;
00093 
00094     /**
00095      * Write the parameters in the given ioHandler
00096      *
00097      * @param handler the ioHandler to be used
00098      * @param complete if true (the default) the enclosing begin/end will
00099      *        be also written, otherwise only the data block will be written.
00100      * @return true if write was successful
00101      *
00102      * This method has to be overloaded.  If not it always returns false.
00103      */
00104     virtual bool write(ioHandler& handler, const bool complete=true) const;
00105 
00106     /**
00107      * Read the parameters from the given ioHandler
00108      *
00109      * @param handler the ioHandler to be used
00110      * @param complete if true (the default) the enclosing begin/end will
00111      *        be also written, otherwise only the data block will be written.
00112      * @return true if write was successful
00113      *
00114      * This method has to be overloaded.  If not it always returns false.
00115      */
00116     virtual bool read(ioHandler& handler,const bool complete=true);
00117   };
00118 
00119   /**
00120    * write
00121    *
00122    * @ingroup gStorable
00123    */
00124   bool write(ioHandler& handler, const ioObject& p, const bool complete=true);
00125 
00126   /**
00127    * read
00128    *
00129    * @ingroup gStorable
00130    */
00131   bool read(ioHandler& handler, ioObject& p, const bool complete=true);
00132 }
00133 
00134 
00135 #endif
00136 

Generated on Sun Sep 20 22:07:59 2009 for CVR-Lib by Doxygen 1.5.8