Statistics
| Branch: | Revision:

root / include / cdummystringpool.h @ fbe00e73

History | View | Annotate | Download (1.75 KB)

1
//==========================================================================
2
//   CDUMMYSTRINGPOOL.H  -  header for
3
//                     Horizon/OMNeT++/OMNEST
4
//            Discrete System Simulation in C++
5
//
6
//
7
//  Declaration of the following classes:
8
//    cDummyStringPool : simple replacement for cStringPool
9
//
10
//==========================================================================
11

    
12
/*--------------------------------------------------------------*
13
  Copyright (C) 1992-2008 Andras Varga
14
  Copyright (C) 2011 Simon Tenbusch, Georg Kunz
15

16
  This file is distributed WITHOUT ANY WARRANTY. See the file
17
  `license' for details on this and other legal matters.
18
*--------------------------------------------------------------*/
19

    
20
#ifndef __CDUMMYSTRINGPOOL_H
21
#define __CDUMMYSTRINGPOOL_H
22
#include "cstringpool.h"
23

    
24
NAMESPACE_BEGIN
25

    
26
/**
27
 * Dummy string pool that effectively disables pooling to avoid implementing
28
 * locked/atomic ref-counting used in Flyweight Stringpool with Horizon. If needed
29
 * a locked/atomic version needs to be implemented.
30
 */
31
class cDummyStringPool : cStringPool
32
{
33
  public:
34

    
35
    /** @name Constructors and destructors */
36
    //@{
37
    /**
38
     * Constructor.
39
     */
40
    cDummyStringPool(const char *poolName=NULL);
41

    
42
    /**
43
     * Destructor.
44
     */
45
    ~cDummyStringPool();
46
    //@}
47

    
48
    /**
49
     * Always allocates a new string and returns a pointer to it.
50
     */
51
    const char *get(const char *s);
52

    
53
    /**
54
     * Just returns the pointer again.
55
     */
56
    const char *peek(const char *s) const;
57

    
58
    /**
59
     * Deletes the given string. The string must be dynamically allocated before.
60
     */
61
    void release(const char *s);
62

    
63
    /**
64
     * For debug purposes.
65
     */
66
    void dump() const;
67
};
68

    
69
NAMESPACE_END
70

    
71
#endif /* __CDUMMYSTRINGPOOL_H */