15 namespace epics {
namespace nt {
33 : path(path), type(type) {}
36 return type == other.
type && path == other.
path;
39 std::ostream&
dump(std::ostream& os)
const {
40 os <<
"Error(path=" << (path.empty() ?
"<root>" :
path) <<
": ";
62 : field(field), path(path), errors(), result(
Pass) {}
68 errors.insert(errors.end(), other.
errors.begin(), other.
errors.end());
78 return result ==
Pass;
90 if (!dynamic_cast<T const *>(field.get())) {
109 T
const *s =
dynamic_cast<T
const *
>(field.get());
113 }
else if (s->getID() != id) {
131 template<Result& (*fn)(Result&)>
133 return has<epics::pvData::Field>(name,
false,
fn);
145 template<Result& (*fn)(Result&)>
147 return has<epics::pvData::Field>(name,
true,
fn);
164 template<Result& (*fn)(Result&),
typename T>
166 return has<T>(name,
false,
fn);
181 template<Result& (*fn)(Result&),
typename T>
183 return has<T>(name,
true,
fn);
201 return has<T>(name,
false,
NULL);
217 return has<T>(name,
true,
NULL);
220 std::ostream&
dump(std::ostream& os)
const {
221 os <<
"Result(valid=" << (result ==
Pass) <<
", errors=[ ";
223 std::vector<Error>::const_iterator it;
224 for (it = errors.begin(); it != errors.end(); ++it) {
237 switch(field->getType()) {
257 std::string subFieldPath(path.empty() ? name : path +
"." + name);
264 }
else if (!dynamic_cast<T const *>(subField.get())) {
268 Result r(subField, subFieldPath);
epics::pvData::FieldConstPtr field
This class implements introspection object for a union.
Result & maybeHas(const std::string &name)
Result(const epics::pvData::FieldConstPtr &field, const std::string &path=std::string())
Validation methods for NT types.
TODO only here because of the Lockable.
Result & is(const std::string &id)
enum epics::nt::Result::result_t result
Result & has(const std::string &name)
Result & maybeHas(const std::string &name)
bool operator==(const Error &other) const
Error(std::string const &path, Type type)
std::ostream & dump(std::ostream &os) const
This class implements introspection object for a structure.
This class implements introspection object for a unionArray.
std::tr1::shared_ptr< const Field > FieldConstPtr
enum epics::nt::Result::Error::Type type
Result & operator|=(const Result &other)
std::vector< Error > errors
This class implements introspection object for a structureArray.
Result & has(const std::string &name)
const ChannelProviderRegistry::factoryfn_t fn
std::ostream & dump(std::ostream &os) const