Skip to content

Commit 5ac87b1

Browse files
EcoLab required modifications.
1 parent 5f1c8f4 commit 5ac87b1

File tree

5 files changed

+75
-36
lines changed

5 files changed

+75
-36
lines changed

RESTProcess_base.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ namespace classdesc
142142
}
143143
return r;
144144
}
145-
RESTProcess_t list() const;
146-
std::string type() const {return "overloaded function";}
145+
RESTProcess_t list() const override;
146+
std::string type() const override {return "overloaded function";}
147147
};
148148

149149
inline void convert(char& y, const string& x)
@@ -498,9 +498,9 @@ namespace classdesc
498498
RPPtr makeRESTProcessValueObject(T&& obj)
499499
{return std::make_shared<RESTProcessValueObject<typename std::remove_reference<T>::type>>(std::forward<T>(obj));}
500500
// specialization for string and string vector to allow
501-
RPPtr makeRESTProcessValueObject(const char* s)
501+
inline RPPtr makeRESTProcessValueObject(const char* s)
502502
{return std::make_shared<RESTProcessValueObject<std::string>>(s);}
503-
RPPtr makeRESTProcessValueObject(const std::initializer_list<std::string>& init)
503+
inline RPPtr makeRESTProcessValueObject(const std::initializer_list<std::string>& init)
504504
{return std::make_shared<RESTProcessValueObject<std::vector<std::string>>>(init);}
505505

506506
/// class that represents the void, or null object
@@ -515,10 +515,10 @@ namespace classdesc
515515
bool isConst() const override {return true;}
516516
};
517517

518-
RPPtr RESTProcessBase::getElem(const REST_PROCESS_BUFFER&)
518+
inline RPPtr RESTProcessBase::getElem(const REST_PROCESS_BUFFER&)
519519
{return std::make_shared<RESTProcessVoid>();}
520520

521-
RPPtr RESTProcessBase::keys() const
521+
inline RPPtr RESTProcessBase::keys() const
522522
{return std::make_shared<RESTProcessVoid>();}
523523

524524
template <class T> T* RESTProcessBase::getObject()

RESTProcess_epilogue.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ namespace classdesc_access
5151
struct access_RESTProcess<T, cd::void_t<typename std::iterator_traits<T>::value_type>>:
5252
public cd::NullDescriptor<cd::RESTProcess_t> {};
5353

54+
#ifdef CLASSDESC_OBJECT_H
55+
template <>
56+
struct access_RESTProcess<cd::object>: public cd::NullDescriptor<cd::RESTProcess_t> {};
57+
58+
template <class T, class B>
59+
struct access_RESTProcess<cd::Object<T,B>>
60+
{
61+
template <class U>
62+
void operator()(cd::RESTProcess_t& repo, const std::string& d, U& a)
63+
{
64+
::RESTProcess(repo,d, cd::base_cast<B>::cast(a));
65+
}
66+
};
67+
#endif
5468
}
5569

5670
namespace classdesc
@@ -110,7 +124,7 @@ namespace classdesc
110124
return map;
111125
}
112126

113-
RESTProcess_t RESTProcessOverloadedFunction::list() const {return {};}
127+
inline RESTProcess_t RESTProcessOverloadedFunction::list() const {return {};}
114128

115129
template <class T>
116130
RESTProcess_t RESTProcessSequence<T>::list() const {
@@ -165,7 +179,7 @@ namespace classdesc
165179
repo.add(d, new RESTProcessObject<T>(obj));
166180
}
167181

168-
RPPtr RESTProcessOverloadedFunction::process(const string& remainder, const REST_PROCESS_BUFFER& arguments)
182+
inline RPPtr RESTProcessOverloadedFunction::process(const string& remainder, const REST_PROCESS_BUFFER& arguments)
169183
{
170184
// sort function overloads by best match
171185
auto cmp=[&](RESTProcessFunctionBase*x, RESTProcessFunctionBase*y)

json_pack_epilogue.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,32 @@ void type(classdesc::json_unpack_t& targ, const classdesc::string& desc)
259259
}
260260
};
261261

262+
#ifdef CLASSDESC_OBJECT_H
263+
template <>
264+
struct access_json_pack<cd::object>: public cd::NullDescriptor<cd::json_pack_t> {};
265+
template <>
266+
struct access_json_unpack<cd::object>: public cd::NullDescriptor<cd::json_unpack_t> {};
267+
268+
template <class T, class B>
269+
struct access_json_pack<cd::Object<T,B>>
270+
{
271+
template <class U>
272+
void operator()(cd::json_pack_t& repo, const std::string& d, U& a)
273+
{
274+
::json_pack(repo,d, cd::base_cast<B>::cast(a));
275+
}
276+
};
277+
278+
template <class T, class B>
279+
struct access_json_unpack<cd::Object<T,B>>
280+
{
281+
template <class U>
282+
void operator()(cd::json_unpack_t& repo, const std::string& d, U& a)
283+
{
284+
::json_unpack(repo,d, cd::base_cast<B>::cast(a));
285+
}
286+
};
287+
#endif
262288

263289
}
264290

object.h

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
Open source licensed under the MIT license. See LICENSE for details.
77
*/
88

9-
#ifndef OBJECT_H
10-
#define OBJECT_H
9+
#ifndef CLASSDESC_OBJECT_H
10+
#define CLASSDESC_OBJECT_H
1111
#include "classdesc.h"
1212
#include "pack_base.h"
1313

@@ -102,7 +102,7 @@ namespace classdesc
102102

103103
template <> struct tn<object> {static string name() {return "object";}};
104104
template <class T, class B> struct tn<Object<T,B>>
105-
{std:: string name() {return "Object<"+typeName<T>()+">"+typeName<B>+">";}};
105+
{static std:: string name() {return "Object<"+typeName<T>()+">"+typeName<B>()+">";}};
106106

107107
}
108108

@@ -156,31 +156,6 @@ unpack(classdesc::unpack_t& b, const classdesc::string& d, const classdesc::shar
156156
}
157157

158158

159-
namespace classdesc_access
160-
{
161-
namespace cd=classdesc;
162-
163-
template <> struct access_pack<classdesc::object>: public cd::NullDescriptor<cd::pack_t>{};
164-
template <> struct access_unpack<classdesc::object>: public cd::NullDescriptor<cd::pack_t>{};
165-
166-
template <class T, class B>
167-
struct access_pack<classdesc::Object<T, B> >
168-
{
169-
template <class U>
170-
void operator()(cd::pack_t& b, const cd::string& d, U& a)
171-
{pack(b,d,cd::base_cast<B>::cast(a));}
172-
};
173-
174-
template <class T, class B>
175-
struct access_unpack<classdesc::Object<T, B> >
176-
{
177-
template <class U>
178-
void operator()(cd::unpack_t& b, const cd::string& d, U& a)
179-
{unpack(b,d,cd::base_cast<B>::cast(a));}
180-
};
181-
182-
}
183-
184159
#ifdef _CLASSDESC
185160
#pragma omit pack classdesc::object
186161
#pragma omit unpack classdesc::object

pack_epilogue.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,29 @@ namespace classdesc_access
1919
{
2020
namespace cd=classdesc;
2121

22+
#ifdef CLASSDESC_OBJECT_H
23+
template <> struct access_pack<classdesc::object>: public cd::NullDescriptor<cd::pack_t>{};
24+
template <> struct access_unpack<classdesc::object>: public cd::NullDescriptor<cd::pack_t>{};
25+
26+
template <class T, class B>
27+
struct access_pack<classdesc::Object<T, B> >
28+
{
29+
template <class U>
30+
void operator()(cd::pack_t& b, const cd::string& d, U& a)
31+
{pack(b,d,cd::base_cast<B>::cast(a));}
32+
};
33+
34+
template <class T, class B>
35+
struct access_unpack<classdesc::Object<T, B> >
36+
{
37+
template <class U>
38+
void operator()(cd::unpack_t& b, const cd::string& d, U& a)
39+
{unpack(b,d,cd::base_cast<B>::cast(a));}
40+
};
41+
42+
43+
#endif
44+
2245
// const arg versions
2346
template <class T>
2447
struct access_pack<const T>
@@ -153,6 +176,7 @@ namespace classdesc_access
153176
unpack(b,d,a.fmap);
154177
}
155178
};
179+
156180
#endif
157181

158182
}

0 commit comments

Comments
 (0)