Poster of Linux kernelThe best gift for a Linux geek
Parameters::Parameter

Parameters::Parameter

Section: C Library Functions (3) Updated: Thu Apr 7 2011
Local index Up
 

NAME

Parameters::Parameter -  

SYNOPSIS


#include <parameters.h>

Inherits Parameters::Value.  

Public Member Functions


const T & get () const

T & set ()

virtual std::string type () const

virtual void print (std::ostream &) const

virtual Value * clone () const
 

Static Public Member Functions


static std::string get_info ()

static void print_info ()

static unsigned int n_objects ()
 

Protected Types


typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 

Protected Member Functions


void increment_constructor_count (const std::string &name)

void increment_destructor_count (const std::string &name)
 

Static Protected Attributes


static Counts _counts

static Threads::atomic< unsigned int > _n_objects

static Threads::spin_mutex _mutex
 

Private Attributes


T _value
 

Detailed Description

 

template<typename T> class Parameters::Parameter< T >

Concrete definition of a parameter value for a specified type.

Definition at line 162 of file parameters.h.  

Member Typedef Documentation

 

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > ReferenceCounter::Counts [protected, inherited]Data structure to log the information. The log is identified by the class name.

Definition at line 105 of file reference_counter.h.  

Member Function Documentation

 

template<typename T > Parameters::Value * Parameters::Parameter< T >::clone () const [inline, virtual]Clone this value. Useful in copy-construction.

Implements Parameters::Value.

Definition at line 262 of file parameters.h.

References Parameters::Parameter< T >::_value.

{
  // No good for Solaris C++! - BSK
//  Parameters::Parameter<T>
//    *copy = new Parameters::Parameter<T>;
  Parameter<T>
    *copy = new Parameter<T>;

  libmesh_assert (copy != NULL);
  
  copy->_value = _value;

  return copy;
}
 

template<typename T> const T& Parameters::Parameter< T >::get () const [inline]Returns:

a read-only reference to the parameter value.

Definition at line 169 of file parameters.h.

References Parameters::Parameter< T >::_value.

{ return _value; }
 

std::string ReferenceCounter::get_info () [static, inherited]Gets a string containing the reference information.

Definition at line 45 of file reference_counter.C.

References ReferenceCounter::_counts, and Quality::name().

Referenced by ReferenceCounter::print_info().

{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)

  std::ostringstream out;
  
  out << '
      << ' ---------------------------------------------------------------------------- 
      << '| Reference count information                                                |
      << ' ---------------------------------------------------------------------------- ;
  
  for (Counts::iterator it = _counts.begin();
       it != _counts.end(); ++it)
    {
      const std::string name(it->first);
      const unsigned int creations    = it->second.first;
      const unsigned int destructions = it->second.second;

      out << '| ' << name << ' reference count information:
          << '|  Creations:    ' << creations    << '
          << '|  Destructions: ' << destructions << ';
    }
  
  out << ' ---------------------------------------------------------------------------- ;

  return out.str();

#else

  return '';
  
#endif
}
 

void ReferenceCounter::increment_constructor_count (const std::string &name) [inline, protected, inherited]Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.

Definition at line 149 of file reference_counter.h.

References ReferenceCounter::_counts, Quality::name(), and Threads::spin_mtx.

Referenced by ReferenceCountedObject< Value >::ReferenceCountedObject().

{
  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
  std::pair<unsigned int, unsigned int>& p = _counts[name];

  p.first++;
}
 

void ReferenceCounter::increment_destructor_count (const std::string &name) [inline, protected, inherited]Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.

Definition at line 167 of file reference_counter.h.

References ReferenceCounter::_counts, Quality::name(), and Threads::spin_mtx.

Referenced by ReferenceCountedObject< Value >::~ReferenceCountedObject().

{
  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
  std::pair<unsigned int, unsigned int>& p = _counts[name];

  p.second++;
}
 

static unsigned int ReferenceCounter::n_objects () [inline, static, inherited]Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 76 of file reference_counter.h.

References ReferenceCounter::_n_objects.

Referenced by System::read_serialized_blocked_dof_objects(), and System::write_serialized_blocked_dof_objects().

  { return _n_objects; }
 

template<typename T > void Parameters::Parameter< T >::print (std::ostream &os) const [inline, virtual]Prints the parameter value to the specified stream.

Implements Parameters::Value.

Definition at line 253 of file parameters.h.

{
  os << _value;
}
 

void ReferenceCounter::print_info () [static, inherited]Prints the reference information to std::cout.

Definition at line 83 of file reference_counter.C.

References ReferenceCounter::get_info().

{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
  
  std::cout << ReferenceCounter::get_info();
  
#endif
}
 

template<typename T> T& Parameters::Parameter< T >::set () [inline]Returns:

a writeable reference to the parameter value.

Definition at line 174 of file parameters.h.

References Parameters::Parameter< T >::_value.

Referenced by Parameters::set().

{ return _value; }
 

template<typename T > std::string Parameters::Parameter< T >::type () const [inline, virtual]String identifying the type of parameter stored.

Implements Parameters::Value.

Definition at line 244 of file parameters.h.

References Quality::name().

{
  return typeid(T).name();
}
 

Member Data Documentation

 

ReferenceCounter::Counts ReferenceCounter::_counts [static, protected, inherited]Actually holds the data.

Definition at line 110 of file reference_counter.h.

Referenced by ReferenceCounter::get_info(), ReferenceCounter::increment_constructor_count(), and ReferenceCounter::increment_destructor_count().  

Threads::spin_mutex ReferenceCounter::_mutex [static, protected, inherited]Mutual exclusion object to enable thread-safe reference counting.

Definition at line 123 of file reference_counter.h.  

Threads::atomic< unsigned int > ReferenceCounter::_n_objects [static, protected, inherited]The number of objects. Print the reference count information when the number returns to 0.

Definition at line 118 of file reference_counter.h.

Referenced by ReferenceCounter::n_objects(), ReferenceCounter::ReferenceCounter(), and ReferenceCounter::~ReferenceCounter().  

template<typename T> T Parameters::Parameter< T >::_value [private]Stored parameter value.

Definition at line 196 of file parameters.h.

Referenced by Parameters::Parameter< T >::clone(), Parameters::Parameter< T >::get(), and Parameters::Parameter< T >::set().

 

Author

Generated automatically by Doxygen for libMesh from the source code.


 

Index

NAME
SYNOPSIS
Public Member Functions
Static Public Member Functions
Protected Types
Protected Member Functions
Static Protected Attributes
Private Attributes
Detailed Description
template<typename T> class Parameters::Parameter< T >
Member Typedef Documentation
typedef std::map<std::string, std::pair<unsigned int, unsigned int> > ReferenceCounter::Counts [protected, inherited]Data structure to log the information. The log is identified by the class name.
Member Function Documentation
template<typename T > Parameters::Value * Parameters::Parameter< T >::clone () const [inline, virtual]Clone this value. Useful in copy-construction.
template<typename T> const T& Parameters::Parameter< T >::get () const [inline]Returns:
std::string ReferenceCounter::get_info () [static, inherited]Gets a string containing the reference information.
void ReferenceCounter::increment_constructor_count (const std::string &name) [inline, protected, inherited]Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.
void ReferenceCounter::increment_destructor_count (const std::string &name) [inline, protected, inherited]Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.
static unsigned int ReferenceCounter::n_objects () [inline, static, inherited]Prints the number of outstanding (created, but not yet destroyed) objects.
template<typename T > void Parameters::Parameter< T >::print (std::ostream &os) const [inline, virtual]Prints the parameter value to the specified stream.
void ReferenceCounter::print_info () [static, inherited]Prints the reference information to std::cout.
template<typename T> T& Parameters::Parameter< T >::set () [inline]Returns:
template<typename T > std::string Parameters::Parameter< T >::type () const [inline, virtual]String identifying the type of parameter stored.
Member Data Documentation
ReferenceCounter::Counts ReferenceCounter::_counts [static, protected, inherited]Actually holds the data.
Threads::spin_mutex ReferenceCounter::_mutex [static, protected, inherited]Mutual exclusion object to enable thread-safe reference counting.
Threads::atomic< unsigned int > ReferenceCounter::_n_objects [static, protected, inherited]The number of objects. Print the reference count information when the number returns to 0.
template<typename T> T Parameters::Parameter< T >::_value [private]Stored parameter value.
Author

This document was created by man2html, using the manual pages.
Time: 21:52:01 GMT, April 16, 2011