OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
BESVersionInfo.cc
Go to the documentation of this file.
1 // BESVersionInfo.cc
2 
3 // This file is part of bes, A C++ back-end server implementation framework
4 // for the OPeNDAP Data Access Protocol.
5 
6 // Copyright (c) 2004-2009 University Corporation for Atmospheric Research
7 // Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu>
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
13 //
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 //
23 // You can contact University Corporation for Atmospheric Research at
24 // 3080 Center Green Drive, Boulder, CO 80301
25 
26 // (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
27 // Please read the full copyright statement in the file COPYRIGHT_UCAR.
28 //
29 // Authors:
30 // pwest Patrick West <pwest@ucar.edu>
31 // jgarcia Jose Garcia <jgarcia@ucar.edu>
32 
33 #ifdef __GNUG__
34 #pragma implementation
35 #endif
36 
37 #include "BESVersionInfo.h"
38 #include "BESInfoList.h"
39 #include "BESInternalError.h"
40 
48  : BESInfo(),
49  _inbes( false ),
50  _inhandler( false ),
51  _info( 0 )
52 {
53  _info = BESInfoList::TheList()->build_info() ;
54 }
55 
57 {
58  if( _info ) delete _info ;
59 }
60 
61 void
62 BESVersionInfo::add_library( const string &name, const string &vers )
63 {
64  add_version( "library", name, vers ) ;
65 }
66 
67 void
68 BESVersionInfo::add_module( const string &name, const string &vers )
69 {
70  add_version( "module", name, vers ) ;
71 }
72 
73 void
74 BESVersionInfo::add_service( const string &name, const list<string> &vers )
75 {
76  map<string,string> props ;
77  props["name"] = name ;
78  begin_tag( "serviceVersion", &props ) ;
79  list<string>::const_iterator i = vers.begin() ;
80  list<string>::const_iterator e = vers.end() ;
81  for( ; i != e; i++ )
82  {
83  add_tag( "version", (*i) ) ;
84  }
85  end_tag( "serviceVersion" ) ;
86 }
87 
88 void
89 BESVersionInfo::add_version( const string &type,
90  const string &name,
91  const string &vers )
92 {
93  map<string,string> attrs ;
94  attrs["name"] = name ;
95  add_tag( type, vers, &attrs ) ;
96 }
97 
105 void
106 BESVersionInfo::dump( ostream &strm ) const
107 {
108  strm << BESIndent::LMarg << "BESVersionInfo::dump - ("
109  << (void *)this << ")" << endl ;
111  strm << BESIndent::LMarg << "in BES version? " << _inbes << endl ;
112  strm << BESIndent::LMarg << "in Handler version? " << _inhandler << endl ;
113  if( _info )
114  {
115  strm << BESIndent::LMarg << "redirection info object:" << endl ;
117  _info->dump( strm ) ;
119  }
120  else
121  {
122  strm << BESIndent::LMarg << "redirection info object: null" << endl ;
123  }
124  BESInfo::dump( strm ) ;
126 }
127