---
name: "ACE_Based_Pointer_Basic"
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_Based_Pointer_Basic"
---

# ACE\_Based\_Pointer\_Basic(3)

A proxy that keeps track of the relative offset of a "pointer" from its base address. This class makes it possible to transparently use "pointers" in shared memory as easily as programming with pointers to local memory. In particular, we don't need to ensure that the base addresses of all the pointers are mapped into separate processes at the same absolute memory base address.

## NAME

ACE\_Based\_Pointer\_Basic -  A proxy that keeps track of the relative offset of a "pointer" from its base address.

This class makes it possible to transparently use "pointers" in shared memory as easily as programming with pointers to local memory.  In particular, we don't need to ensure that the base addresses of all the pointers are mapped into separate processes at the same absolute memory base address.

## SYNOPSIS

```
#include <ace/Based_Pointer_T.h>
template<class CONCRETE>
class ACE_Based_Pointer_Basic
{
  public:
    ACE_Based_Pointer_Basic (void);
    ACE_Based_Pointer_Basic (CONCRETE *initial);
    ACE_Based_Pointer_Basic (
        const ACE_Based_Pointer_Basic<CONCRETE> &
        );
    void operator = (CONCRETE *from);
    void operator = (const ACE_Based_Pointer_Basic<CONCRETE> &);
    CONCRETE operator * (void) const;
    int operator < (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
    int operator <= (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
    int operator > (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
    int operator >= (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
    int operator == (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
    int operator != (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
    CONCRETE operator [](int index) const;
    void operator+= (int index);
    operator CONCRETE *() const;
    CONCRETE *addr (void) const;
    ACE_ALLOC_HOOK_DECLARE;
    void dump (void) const;
  protected:
    long target_;
    long base_offset_;
};
```

## PUBLIC MEMBERS

```
ACE_Based_Pointer_Basic (void);
```

This constructor initializes the base\_offset\_ by asking the ACE\_BASED\_POINTER\_REPOSITORY Singleton for the base address of the memory region within which it is instantiated.  Two results are possible:

1\. An ACE\_\*\_Memory\_Pool has stored a base address/size pair and the\
    new based-pointer instance is located between the base address and\
    the base address + size - 1.  In this case, the repository\
    returns the base address.

2\. No suitable address/size pair was found.  The repository\
    assumes an address in the regular (not mapped) virtual address\
    space of the process and returns 0.  In this case, the\
    based-pointer uses its address as an offset to it's base\
    address 0.

```
ACE_Based_Pointer_Basic (CONCRETE *initial);
```

Initialize this object using the initial pointer.  This constructor initializes the base\_offset\_ by asking the ACE\_BASED\_POINTER\_REPOSITORY Singleton for the base address of the memory region within which it is instantiated.  Two results are possible:

1\. An ACE\_\*\_Memory\_Pool has stored a base address/size pair and the\
    new based-pointer instance is located between the base address and\
    the base address + size - 1.  In this case, the repository\
    returns the base address.

2\. No suitable address/size pair was found.  The repository\
    assumes an address in the regular (not mapped) virtual address\
    space of the process and returns 0.  In this case, the\
    based-pointer uses its address as an offset to it's base\
    address 0.

```
ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic<CONCRETE> &);
```

Copy constructor.

```
void operator = (CONCRETE *from);
```

Pseudo-assignment operator.

```
void operator = (const ACE_Based_Pointer_Basic<CONCRETE> &);
```

Pseudo-assignment operator.

```
CONCRETE operator * (void) const;
```

Dereference operator.

```
int operator < (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
```

Less than operator.

```
int operator <= (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
```

Less than or equal operator.

```
int operator > (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
```

Greater than operator.

```
int operator >= (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
```

Greater than or equal operator.

```
int operator == (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
```

Equality operator.

```
int operator != (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
```

Inequality operator.

```
CONCRETE operator [](int index) const;
```

Subscript operator.

```
void operator+= (int index);
```

Increment operator.

```
operator CONCRETE *() const;
```

Returns the underlying memory address of the smart pointer.

```
CONCRETE *addr (void) const;
```

Returns the underlying memory address of the smart pointer.

```
ACE_ALLOC_HOOK_DECLARE;
```

Declare the dynamic allocation hooks.

```
void dump (void) const;
```

Dump the state of the object.

## PROTECTED MEMBERS

```
long target_;
```

```
long base_offset_;
```

Keep track of our offset from the base pointer.

## AUTHOR

Dietrich Quehl Dietrich.Quehl@med.siemens.de and Douglas C. Schmidt schmidt@.cs.wustl.edu

## LIBRARY

ace
