rippled
Loading...
Searching...
No Matches
basic_prop.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef RIPPLE_TEST_JTX_BASIC_PROP_H_INCLUDED
21#define RIPPLE_TEST_JTX_BASIC_PROP_H_INCLUDED
22
23#include <memory>
24
25namespace ripple {
26namespace test {
27namespace jtx {
28
30{
31 virtual ~basic_prop() = default;
33 clone() const = 0;
34 virtual bool
35 assignable(basic_prop const*) const = 0;
36};
37
38template <class T>
40{
41 T t;
42
43 template <class... Args>
44 prop_type(Args&&... args) : t(std::forward<Args>(args)...)
45 {
46 }
47
49 clone() const override
50 {
52 }
53
54 bool
55 assignable(basic_prop const* src) const override
56 {
57 return dynamic_cast<prop_type<T> const*>(src);
58 }
59};
60
61} // namespace jtx
62} // namespace test
63} // namespace ripple
64
65#endif
T is_same_v
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
STL namespace.
virtual ~basic_prop()=default
virtual std::unique_ptr< basic_prop > clone() const =0
virtual bool assignable(basic_prop const *) const =0
bool assignable(basic_prop const *src) const override
Definition basic_prop.h:55
std::unique_ptr< basic_prop > clone() const override
Definition basic_prop.h:49
prop_type(Args &&... args)
Definition basic_prop.h:44