S3FC project page | S3FC home page |
00001 /* 00002 * Stone Three Foundation Class (s3fc) provides a number of utility classes. 00003 * Copyright (C) 2001 by Stone Three Signal Processing (Pty) Ltd. 00004 * 00005 * Authored by Stone Three Signal Processing (Pty) Ltd. 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * Please see the file 'COPYING' in the source root directory. 00022 */ 00023 00030 // 00031 template <typename T> 00032 T s3_config_node::get_value() const 00033 { 00034 return s3_conversion::from_string<T>(a_value); 00035 } 00036 00037 // 00038 template <typename T> 00039 void s3_config_node::set_value( const T& n_value ) 00040 { 00041 a_value = s3_conversion::to_string<T>( n_value ); 00042 } 00043 00044 // 00045 template<typename T> 00046 T s3_config_node::get_value_at(const std::string& path) const 00047 { 00048 const s3_config_node& node = get_node_at(path); 00049 T value = node.get_value<T>(); 00050 return value; 00051 } 00052 00053 // 00054 template<typename T> 00055 T s3_config_node::get_attribute_at( const std::string& attr_name ) const 00056 { 00057 std::map<std::string, std::string>::const_iterator it = a_attributes.find( attr_name ); 00058 if ( it == a_attributes.end() ) 00059 { 00060 return T(); 00061 } 00062 else 00063 { 00064 return s3_conversion::from_string<T>( it->second ); 00065 } 00066 }
Send comments to: s3fc@stonethree.com |
|