|
|
Go to the documentation of this file.
15 bool alreadyIn(
false);
16 for (
const auto&
p : ns) {
17 if (
p.ns() ==
n.ns()) {
30 os << *(defined.first) <<
" ";
32 part.rep().stream(os);
34 os <<
"* logicalpart not defined * ";
37 os <<
"* logicalpart not declared * ";
176 std::vector<const DDsvalues_type*>
result;
189 rep().addSpecifics(
s);
207 size_t p =
me.find(
".");
208 m_ok =
p != std::string::npos;
211 m_range.first =
me.substr(0,
p);
212 m_range.second = m_range.first +
"{";
215 regcomp(&m_regex,
me.c_str(), 0);
224 bool empty(
void)
const {
return me.empty(); }
226 bool notRegex(
void)
const {
return !m_ok; }
232 return !regexec(&m_regex,
s.c_str(), 0,
nullptr, 0);
237 const std::pair<std::string, std::string>&
range(
void)
const {
return m_range; }
244 std::pair<std::string, std::string> m_range;
250 std::vector<DDLogicalPart>&
result,
255 return std::make_pair(
true,
"");
260 bool emptyNs = aNsRegex.empty();
272 typedef std::vector<LPNAMES::value_type::const_iterator> Candidates;
274 if (aRegex.notRegex()) {
275 LPNAMES::value_type::const_iterator it =
LPNAMES::instance().find(aRegex.value());
279 if (!aRegex.range().first.empty()) {
283 for (LPNAMES::value_type::const_iterator it = bn; it != ed; ++it)
284 if (aRegex.match(it->first))
290 if (emptyNs && (sz == 1)) {
291 result.emplace_back(it->second[0]);
297 }
else if (!emptyNs) {
298 std::vector<DDName>::const_iterator nsit(it->second.begin()), nsed(it->second.end());
299 for (; nsit != nsed; ++nsit) {
301 bool another_doit = aNsRegex.match(nsit->ns());
308 std::string message =
"DDLogicalPart-name \"" + it->first +
"\" matching regex \"" + nm +
309 "\" has been found at least in following namespaces:\n";
310 std::vector<DDName>::const_iterator vit = it->second.begin();
311 for (; vit != it->second.end(); ++vit) {
312 message += vit->ns();
315 message +=
"\nQualify the name with a regexp for the namespace, i.e \".*:name-regexp\" !";
316 return std::make_pair(
false, message);
324 std::vector<DDLogicalPart>::const_iterator lpit(
result.begin()), lped(
result.end());
325 for (; lpit != lped; ++lpit) {
327 if (!lpit->isDefined().second) {
328 message = message +
"LogicalPart " + lpit->name().fullname() +
" not (yet) defined!\n";
334 message =
"No regex-match for namespace=" + ns +
" name=" + nm +
"\n";
337 return std::make_pair(
flag, message);
342 return rep().attachedSpecifics();
std::pair< const N *, bool > def_type
DDName is used to identify DDD entities uniquely.
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
DDLogicalPart(void)
The default constructor provides an uninitialzed reference object.
DDMaterial is used to define and access material information.
std::pair< bool, std::string > DDIsValid(const std::string &ns, const std::string &nm, std::vector< DDLogicalPart > &result, bool doRegex)
void removeSpecifics(const std::pair< DDPartSelection *, DDsvalues_type * > &)
const DDName & name() const
const DDI::rep_traits< DDName, std::unique_ptr< DDI::LogicalPart > >::reference rep() const
std::vector< const DDsvalues_type * > specifics(void) const
returns the specific-data attached to the LogicalPart only (not to a DDExpandedNode)
DDEnums::Category category(void) const
Returns the categorization of the DDLogicalPart (sensitive detector element, cable,...
const DDName & ddname() const
static value_type & instance()
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
void DD_NC(const DDName &n)
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
void create(const DDName &name, std::unique_ptr< DDI::LogicalPart > vals)
const std::vector< std::pair< const DDPartSelection *, const DDsvalues_type * > > & attachedSpecifics(void) const
A DDSolid represents the shape of a part.
DDsvalues_type mergedSpecifics(void) const
returns the merged-specifics, i.e. the last specified specifics of this logical-part
void addSpecifics(const std::pair< const DDPartSelection *, const DDsvalues_type * > &)
don't use, internal only /todo make it private
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
bool hasDDValue(const DDValue &) const
std::ostream & operator<<(std::ostream &os, const DDLogicalPart &part)