Public Member Functions | Private Member Functions | Private Attributes

ACE_Env_Value< T > Class Template Reference

Environment Variable Value. More...

#include <Env_Value_T.h>

Collaboration diagram for ACE_Env_Value< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ACE_Env_Value (void)
 ACE_Env_Value (const ACE_TCHAR *varname, const T &vardefault)
 Constructor that calls <open>.
 ~ACE_Env_Value (void)
 Destroy the value.
 operator T (void)
 Returns the value as type T.
void open (const ACE_TCHAR *varname, const T &defval)
const ACE_TCHARvarname (void) const
 Returns the name of the variable being tracked.

Private Member Functions

 ACE_Env_Value (const ACE_Env_Value< T > &)
 Disallow copying and assignment.
ACE_Env_Value< T > operator= (const ACE_Env_Value< T > &)
void fetch_value (void)

Private Attributes

const ACE_TCHARvarname_
value_

Detailed Description

template<class T>
class ACE_Env_Value< T >

Environment Variable Value.

Reads a variable from the user environment, providing a default value.

Definition at line 41 of file Env_Value_T.h.


Constructor & Destructor Documentation

template<class T >
ACE_Env_Value< T >::ACE_Env_Value ( void   )  [inline]

Default constructor which isn't bound to a specific environment variable name or a default value. Before being useful it must <open>'d.

Definition at line 12 of file Env_Value_T.inl.

  : varname_ (0)
{
}

template<class T >
ACE_Env_Value< T >::ACE_Env_Value ( const ACE_TCHAR varname,
const T &  vardefault 
) [inline]

Constructor that calls <open>.

Definition at line 18 of file Env_Value_T.inl.

  : varname_ (varname),
    value_(defval)
{
  this->fetch_value ();
}

template<class T >
ACE_Env_Value< T >::~ACE_Env_Value ( void   )  [inline]

Destroy the value.

Definition at line 56 of file Env_Value_T.inl.

{
}

template<class T >
ACE_Env_Value< T >::ACE_Env_Value ( const ACE_Env_Value< T > &   )  [private]

Disallow copying and assignment.


Member Function Documentation

template<class T >
void ACE_Env_Value< T >::fetch_value ( void   )  [inline, private]

Definition at line 36 of file Env_Value_T.inl.

{
#if defined (ACE_WIN32)
  const ACE_TCHAR *env = ACE_OS::getenv (this->varname_);
  if (env != 0)
    ACE_Convert (env, value_);
#else
  char *nenv = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (this->varname_));
  if (nenv != 0)
    ACE_Convert (ACE_TEXT_CHAR_TO_TCHAR (nenv), this->value_);
#endif
}

template<class T >
void ACE_Env_Value< T >::open ( const ACE_TCHAR varname,
const T &  defval 
) [inline]

The constructor, read varname from the environment, using defval as its value if it is not defined.

Definition at line 27 of file Env_Value_T.inl.

{
  this->varname_ = varname;
  this->value_ = defval;
  this->fetch_value ();
}

template<class T >
ACE_Env_Value< T >::operator T ( void   )  [inline]

Returns the value as type T.

Definition at line 6 of file Env_Value_T.inl.

{
  return value_;
}

template<class T >
ACE_Env_Value<T> ACE_Env_Value< T >::operator= ( const ACE_Env_Value< T > &   )  [private]
template<class T >
const ACE_TCHAR * ACE_Env_Value< T >::varname ( void   )  const [inline]

Returns the name of the variable being tracked.

Definition at line 50 of file Env_Value_T.inl.

{
  return this->varname_;
}


Member Data Documentation

template<class T >
T ACE_Env_Value< T >::value_ [private]

Definition at line 76 of file Env_Value_T.h.

template<class T >
const ACE_TCHAR* ACE_Env_Value< T >::varname_ [private]

Definition at line 75 of file Env_Value_T.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines