blob: 6ab4ee5cadce5b6156a7cadcabea28546c178289 [file] [log] [blame]
Neale Ranns812ed392017-10-16 04:20:13 -07001/*
2 * Copyright (c) 2017 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#include "vom/object_base.hpp"
17
18namespace VOM {
19object_ref::object_ref(std::shared_ptr<object_base> obj)
20 : m_obj(obj)
21 , m_state(OBJECT_STATE_NONE)
22{
23}
24
25bool
26object_ref::operator<(const object_ref& other) const
27{
28 return (m_obj.get() < other.m_obj.get());
29}
30
31std::shared_ptr<object_base>
32object_ref::obj() const
33{
34 return (m_obj);
35}
36
37void
38object_ref::mark() const
39{
40 m_state = OBJECT_STATE_STALE;
41}
42
43void
44object_ref::clear() const
45{
46 m_state = OBJECT_STATE_NONE;
47}
48
49bool
50object_ref::stale() const
51{
52 return (m_state == OBJECT_STATE_STALE);
53}
54
55std::ostream&
56operator<<(std::ostream& os, const object_base& o)
57{
58 os << o.to_string();
59
60 return (os);
61}
62}
63
64/*
65 * fd.io coding-style-patch-verification: ON
66 *
67 * Local Variables:
68 * eval: (c-set-style "mozilla")
69 * End:
70 */