| 1 |
#ifndef INCLUDED_SEMANTIC_ |
| 2 |
#define INCLUDED_SEMANTIC_ |
| 3 |
|
| 4 |
#include <memory> |
| 5 |
#include <ostream> |
| 6 |
|
| 7 |
#include "../base/base.h" |
| 8 |
|
| 9 |
class Semantic: public std::shared_ptr<Base> |
| 10 |
{ |
| 11 |
friend std::ostream &operator<<(std::ostream &out, Semantic const &obj); |
| 12 |
|
| 13 |
public: |
| 14 |
Semantic(Base *bp = 0); // Semantic owns the bp |
| 15 |
~Semantic() = default; |
| 16 |
}; |
| 17 |
|
| 18 |
inline Semantic::Semantic(Base *bp) |
| 19 |
: |
| 20 |
std::shared_ptr<Base>(bp) |
| 21 |
{} |
| 22 |
|
| 23 |
inline std::ostream &operator<<(std::ostream &out, Semantic const &obj) |
| 24 |
{ |
| 25 |
if (obj) |
| 26 |
return out << *obj; |
| 27 |
|
| 28 |
return out << "<UNDEFINED>"; |
| 29 |
} |
| 30 |
|
| 31 |
#endif |