Blame DapObj.h

Packit a4aae4
// DapObj.h
Packit a4aae4
Packit a4aae4
// -*- mode: c++; c-basic-offset:4 -*-
Packit a4aae4
Packit a4aae4
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
Packit a4aae4
// Access Protocol.
Packit a4aae4
Packit a4aae4
// Copyright (c) 2002,2003 OPeNDAP, Inc.
Packit a4aae4
// Author: Patrick West <pwest@ucar.org>
Packit a4aae4
//
Packit a4aae4
// This library is free software; you can redistribute it and/or
Packit a4aae4
// modify it under the terms of the GNU Lesser General Public
Packit a4aae4
// License as published by the Free Software Foundation; either
Packit a4aae4
// version 2.1 of the License, or (at your option) any later version.
Packit a4aae4
//
Packit a4aae4
// This library is distributed in the hope that it will be useful,
Packit a4aae4
// but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit a4aae4
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit a4aae4
// Lesser General Public License for more details.
Packit a4aae4
//
Packit a4aae4
// You should have received a copy of the GNU Lesser General Public
Packit a4aae4
// License along with this library; if not, write to the Free Software
Packit a4aae4
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
Packit a4aae4
//
Packit a4aae4
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
Packit a4aae4
Packit a4aae4
// (c) COPYRIGHT URI/MIT 1994-1999
Packit a4aae4
// Please read the full copyright statement in the file COPYRIGHT_URI.
Packit a4aae4
//
Packit a4aae4
// Authors:
Packit a4aae4
//      pwest       Patrick West <pwest@ucar.edu>
Packit a4aae4
Packit a4aae4
/** @brief top level DAP object to house generic methods
Packit a4aae4
 */
Packit a4aae4
Packit a4aae4
#ifndef A_DapObj_h
Packit a4aae4
#define A_DapObj_h 1
Packit a4aae4
Packit a4aae4
#include <iostream>
Packit a4aae4
Packit a4aae4
using std::ostream ;
Packit a4aae4
using std::endl ;
Packit a4aae4
Packit a4aae4
#include "DapIndent.h"
Packit a4aae4
Packit a4aae4
namespace libdap
Packit a4aae4
{
Packit a4aae4
Packit a4aae4
/** @brief libdap base object for common functionality of libdap objects
Packit a4aae4
 *
Packit a4aae4
 * A base object for any libdap objects to use. Provides simple
Packit a4aae4
 * methods for dumping the contents of the object.
Packit a4aae4
 */
Packit a4aae4
Packit a4aae4
class DapObj
Packit a4aae4
{
Packit a4aae4
public:
Packit a4aae4
    virtual  ~DapObj()
Packit a4aae4
    {}
Packit a4aae4
Packit a4aae4
    /** @brief dump the contents of this object to the specified ostream
Packit a4aae4
     *
Packit a4aae4
     * This method is implemented by all derived classes to dump their
Packit a4aae4
     * contents, in other words, any state they might have, private variables,
Packit a4aae4
     * etc...
Packit a4aae4
     *
Packit a4aae4
     * @param strm C++ i/o stream to dump the object to
Packit a4aae4
     */
Packit a4aae4
    virtual void dump(ostream &strm) const = 0 ;
Packit a4aae4
} ;
Packit a4aae4
Packit a4aae4
} // namespace libdap
Packit a4aae4
Packit a4aae4
/** @brief dump the contents of the specified object to the specified ostream
Packit a4aae4
 *
Packit a4aae4
 * This inline method uses the dump method of the DapObj instance passed
Packit a4aae4
 * to it. This allows a user to dump the contents of an object instead of just
Packit a4aae4
 * getting the pointer value of the object.
Packit a4aae4
 *
Packit a4aae4
 * @param strm C++ i/o stream to dump the object to
Packit a4aae4
 * @param obj The DapObj to dump
Packit a4aae4
 */
Packit a4aae4
inline ostream &
Packit a4aae4
operator<<(ostream &strm, const libdap::DapObj &obj)
Packit a4aae4
{
Packit a4aae4
    obj.dump(strm) ;
Packit a4aae4
    return strm ;
Packit a4aae4
}
Packit a4aae4
Packit a4aae4
#endif // A_DapObj_h
Packit a4aae4