// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: SS_ConfigObject.cc
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
// The above named program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License version 2 as published by the Free Software Foundation.
// The above named program is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// You should have received a copy of the GNU General Public
// License along with this work; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
// ========== Copyright Header End ============================================
#include "SS_ConfigObject.h"
SS_ConfigVariable::SS_ConfigVariable( const char* _value
)/*{{{*/
void SS_ConfigVariable::reflect()/*{{{*/
printf("%s",value
.data());
SS_ConfigString::SS_ConfigString( const char* _value
)/*{{{*/
value
.assign(value
,1,value
.size() - 2);
void SS_ConfigString::reflect()/*{{{*/
printf("\"%s\"",value
.data());
SS_ConfigNumber::SS_ConfigNumber( uint64_t _value
)/*{{{*/
void SS_ConfigNumber::reflect()/*{{{*/
SS_ConfigValueList::~SS_ConfigValueList()/*{{{*/
for (std::list
<SS_ConfigValue
*>::iterator i
= value
.begin(); i
!= value
.end(); i
++)
void SS_ConfigValueList::reflect()/*{{{*/
std::list
<SS_ConfigValue
*>::iterator i
= value
.begin();
SS_ConfigFieldList::~SS_ConfigFieldList()/*{{{*/
for (std::map
<std::string
,SS_ConfigValue
*>::iterator i
= field
.begin(); i
!= field
.end(); i
++)
void SS_ConfigFieldList::reflect()/*{{{*/
for (std::map
<std::string
,SS_ConfigValue
*>::iterator i
= field
.begin(); i
!= field
.end(); i
++)
printf(" %s: ",i
->first
.data());
SS_ConfigObject::SS_ConfigObject( const std::string
& _name
, const std::string
& _type
, SS_ConfigFieldList
* _prop
)/*{{{*/
SS_ConfigObject::~SS_ConfigObject()/*{{{*/
void SS_ConfigObject::reflect()/*{{{*/
printf("OBJECT %s TYPE %s {\n",name
.data(),type
.data());
SS_ConfigObjectList::~SS_ConfigObjectList()/*{{{*/
for (std::map
<std::string
,SS_ConfigObject
*>::iterator i
= object
.begin(); i
!= object
.end(); i
++)
void SS_ConfigObjectList::reflect()/*{{{*/
for (std::map
<std::string
,SS_ConfigObject
*>::iterator i
= object
.begin(); i
!= object
.end(); i
++)
printf("OBJECT %s\n",i
->first
.data());
extern SS_ConfigObjectList
* config_parse( const char* filename
);
extern SS_ConfigObjectList
* config_objects
;
SS_ConfigReader::SS_ConfigReader( const char* filename
)/*{{{*/
yyin
= fopen(filename
,"r");
SS_ConfigReader::~SS_ConfigReader()/*{{{*/
SS_ConfigValue
* SS_ConfigReader::value( const char* object
, const char* field
)/*{{{*/
std::map
<std::string
,SS_ConfigObject
*>::const_iterator o
= config
->object
.find(object
);
if (o
== config
->object
.end())
std::map
<std::string
,SS_ConfigValue
*>::const_iterator f
= o
->second
->prop
->field
.find(field
);
if (f
== o
->second
->prop
->field
.end())
return o
->second
->prop
->field
[field
];
void SS_ConfigReader::reflect()/*{{{*/