Ocean
Loading...
Searching...
No Matches
TestSingleton.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_TEST_TESTBASE_TEST_SINGLETON_H
9#define META_OCEAN_TEST_TESTBASE_TEST_SINGLETON_H
10
12
14
15namespace Ocean
16{
17
18namespace Test
19{
20
21namespace TestBase
22{
23
24/**
25 * This class implements a singleton test.
26 * @ingroup testbase
27 */
28class OCEAN_TEST_BASE_EXPORT TestSingleton
29{
30 protected:
31
32 /**
33 * This class implements a helper class to test singleton template.
34 */
35 class SingletonUser : public Ocean::Singleton<SingletonUser>
36 {
37 friend class Ocean::Singleton<SingletonUser>;
38
39 public:
40
41 /**
42 * Returns a value.
43 * @return Return value
44 */
45 unsigned int value() const;
46
47 protected:
48
49 /**
50 * Creates a new object.
51 */
53
54 /**
55 * Destructs a value.
56 */
57 virtual ~SingletonUser();
58
59 protected:
60
61 /// Object value.
62 unsigned int userValue;
63 };
64
65 public:
66
67 /**
68 * Tests all singleton functions.
69 * @return True, if succeeded
70 */
71 static bool test();
72
73 /**
74 * Tests the get function (creating the instance).
75 * @return True, if succeeded
76 */
77 static bool testInstance();
78};
79
80}
81
82}
83
84}
85
86#endif // META_OCEAN_TEST_TESTBASE_TEST_SINGLETON_H
This template class is the base class for all singleton objects.
Definition Singleton.h:71
This class implements a helper class to test singleton template.
Definition TestSingleton.h:36
unsigned int value() const
Returns a value.
unsigned int userValue
Object value.
Definition TestSingleton.h:62
This class implements a singleton test.
Definition TestSingleton.h:29
static bool test()
Tests all singleton functions.
The namespace covering the entire Ocean framework.
Definition Accessor.h:15