fieker-DuValspielwiese
Last change
on this file since 781efb was
781efb,
checked in by Frank Seelisch <seelisch@…>, 15 years ago
|
additional files for test code (minors, C++ wrappers)
git-svn-id: file:///usr/local/Singular/svn/trunk@12113 2c84dea3-7e68-4137-9b89-c4e89433aadc
|
-
Property mode set to
100644
|
File size:
970 bytes
|
Line | |
---|
1 | #ifndef REFERENCE_COUNTER_H |
---|
2 | #define REFERENCE_COUNTER_H |
---|
3 | |
---|
4 | #include <iostream> |
---|
5 | |
---|
6 | class ReferenceCounter { |
---|
7 | public: |
---|
8 | /// Set type for storing reference counter |
---|
9 | typedef unsigned long refcount_type; |
---|
10 | |
---|
11 | /// Default constructor |
---|
12 | ReferenceCounter(): m_counter(0) { std::cout << "\n ReferenceCounter default constructor"; } |
---|
13 | |
---|
14 | /// Deep copy |
---|
15 | ReferenceCounter(const ReferenceCounter& rc) { assume(false); /* copy constructor should never be called */ } |
---|
16 | |
---|
17 | /// Destructor |
---|
18 | ~ReferenceCounter() { std::cout << "\n ReferenceCounter destructor"; } |
---|
19 | |
---|
20 | /// Get reference counter |
---|
21 | refcount_type getCounter() const { return m_counter; } |
---|
22 | |
---|
23 | /// Check, whether reference is used multiple times |
---|
24 | bool isShared() const { return (m_counter > 1); } |
---|
25 | |
---|
26 | /// Increase reference counter |
---|
27 | refcount_type increment(); |
---|
28 | |
---|
29 | /// Decrease reference counter |
---|
30 | refcount_type decrement(); |
---|
31 | |
---|
32 | private: |
---|
33 | /// Store reference counter |
---|
34 | refcount_type m_counter; |
---|
35 | }; |
---|
36 | |
---|
37 | #endif |
---|
38 | /* REFERENCE_COUNTER_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.