casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
AppRC.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //# AppRC.h: Definition of the AppRC class
00003 //# Copyright (C) 1997,1998,1999,2000,2001,2002,2003
00004 //# Associated Universities, Inc. Washington DC, USA.
00005 //#
00006 //# This library is free software; you can redistribute it and/or modify it
00007 //# under the terms of the GNU Library General Public License as published by
00008 //# the Free Software Foundation; either version 2 of the License, or (at your
00009 //# option) any later version.
00010 //#
00011 //# This library is distributed in the hope that it will be useful, but WITHOUT
00012 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00014 //# License for more details.
00015 //#
00016 //# You should have received a copy of the GNU Library General Public License
00017 //# along with this library; if not, write to the Free Software Foundation,
00018 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00019 //#
00020 //# Correspondence concerning AIPS++ should be addressed as follows:
00021 //#        Internet email: aips2-request@nrao.edu.
00022 //#        Postal address: AIPS++ Project Office
00023 //#                        National Radio Astronomy Observatory
00024 //#                        520 Edgemont Road
00025 //#                        Charlottesville, VA 22903-2475 USA
00026 //#
00027 //# $Id$
00028 #ifndef SYNTHESIS_APPRC_H
00029 #define SYNTHESIS_APPRC_H
00030 
00031 #include <casa/aips.h>
00032 #include <casa/System/Casarc.h>
00033 #include <casa/sstream.h>
00034 #include <iostream.h>
00035 
00036 using namespace std;
00037 
00038 namespace casa { //# NAMESPACE CASA - BEGIN
00039   class AppRC
00040   {
00041   public:
00042     AppRC()
00043       :rc_p(NULL), rcCleanup(),addPID_p(False), deleteFile_p(True),
00044        id_p()
00045     {};
00046     
00047     AppRC(const string& filename, 
00048           const Bool addPID=False,
00049           const Bool deleteFile=True)
00050       :rc_p(NULL), rcCleanup(), deleteFile_p(deleteFile), id_p()
00051     {init(filename,addPID,deleteFile_p);};
00052     
00053     ~AppRC();
00054     
00055     void setID(const string& id) {id_p=id;};
00056     void init(const string& filename, const Bool addPID=False, 
00057               const Bool deleteFile=True);
00058 
00059     string get(const string& name);
00060     string get(const string& name, Int& val);
00061     string get(const string& name, Float& val);
00062     string get(const string& name, Double& val);
00063     void put(const string& name, const string& val);
00064     void put(const string& name, const Int& val);
00065     void put(const string& name, const Float& val);
00066     void put(const string& name, const Double& val);
00067     
00068   private:
00069     Casarc *rc_p;
00070     CasarcCleanup rcCleanup;
00071     pid_t myPID_p, myTID_p;
00072     Bool addPID_p,deleteFile_p;
00073     string fileName_p, id_p;
00074     void setPID() {/*myTID_p = gettid_p ();*/ myPID_p = getpid ();}
00075   };
00076   
00077 }; //# NAMESPACE CASA - END
00078 
00079 #endif //