---
name: "ACE_Env_Value"
section: "3"
platform: "linux"
package: "libace-doc"
version: "5.0.7-4"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/ACE_Env_Value"
---

# ACE\_Env\_Value(3)

Enviroment Variable Value

## NAME

ACE\_Env\_Value -  Enviroment Variable Value

## SYNOPSIS

```
template<class T>
class ACE_Env_Value
{
  public:
    ACE_Env_Value (void);
    ACE_Env_Value (const ASYS_TCHAR *varname, const T &vardefault);
    ~ACE_Env_Value (void);
    operator T (void);
    void open (const ASYS_TCHAR *varname, const T &defval);
    const ASYS_TCHAR *varname (void) const;
  private:
    inline ACE_UNIMPLEMENTED_FUNC (
        ACE_Env_Value(const ACE_Env_Value<T> &)
        );
    void fetch_value (void);
    const ASYS_TCHAR *varname_;
    T value_;
};
```

## DESCRIPTION

Template to encapsulate getting a value from an environment variable and using a supplied default value if not in the environment.

## PUBLIC MEMBERS

```
ACE_Env_Value (void);
```

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

```
ACE_Env_Value (const ASYS_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 ASYS_TCHAR *varname, const T &defval);
```

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

```
const ASYS_TCHAR *varname (void) const;
```

Returns the name of the variable being tracked.

## PRIVATE MEMBERS

```
inline ACE_UNIMPLEMENTED_FUNC (
    ACE_Env_Value(const ACE_Env_Value<T> &)
    );
```

Disallow copying and assignment.

```
void fetch_value (void);
```

```
const ASYS_TCHAR *varname_;
```

```
T value_;
```

## AUTHOR

Chris Cleeland (derived from work by Carlos O'Ryan)

## LIBRARY

ACE
