Debian Codegraph @

tests/boost/bar.h

raw symbols SCIP
1 // -*- Mode: C++; c-file-style: "stroustrup"; indent-tabs-mode:nil; -*-
2 #ifndef BAR_H_
3 # define BAR_H_
4
5 #include <string>
6 #include <boost/shared_ptr.hpp>
7
8
9 class Foo
10 {
11 std::string m_datum;
12 bool m_initialized;
13 public:
14 static int instance_count;
15
16 Foo () : m_datum (""), m_initialized (false)
17 { Foo::instance_count++; }
18
19 Foo (std::string const &datum) : m_datum (datum), m_initialized (false)
20 { Foo::instance_count++; }
21 const std::string get_datum () const { return m_datum; }
22
23 Foo (Foo const & other) : m_datum (other.get_datum ()), m_initialized (false)
24 { Foo::instance_count++; }
25
26 void initialize () { m_initialized = true; }
27 bool is_initialized () const { return m_initialized; }
28
29 virtual ~Foo() { Foo::instance_count--; }
30
31 };
32
33 inline std::ostream & operator << (std::ostream &os, Foo const &foo)
34 {
35 os << foo.get_datum ();
36 return os;
37 }
38
39
40 void function_that_takes_foo (boost::shared_ptr<Foo> foo);
41 boost::shared_ptr<Foo> function_that_returns_foo ();
42
43
44 class ClassThatTakesFoo
45 {
46 boost::shared_ptr<Foo> m_foo;
47 public:
48 ClassThatTakesFoo(boost::shared_ptr<Foo> foo) : m_foo(foo) {}
49 boost::shared_ptr<Foo> get_foo () const { return m_foo; }
50
51 virtual boost::shared_ptr<Foo> get_modified_foo (boost::shared_ptr<Foo> foo) const { return m_foo; }
52 virtual ~ClassThatTakesFoo() {}
53 };
54
55
56 #endif /* !FOO_H_ */