MCPcopy Create free account
hub / github.com/apache/mesos / contains

Method contains

src/common/attributes.cpp:92–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90
91
92bool Attributes::contains(const Attribute& attribute) const
93{
94 foreach (const Attribute& attr, attributes) {
95 if (attr.name() == attribute.name() && attr.type() == attribute.type()) {
96 switch (attr.type()) {
97 case Value::SCALAR:
98 if (attr.scalar() == attribute.scalar()) {
99 return true;
100 }
101 break;
102
103 case Value::RANGES:
104 if (attr.ranges() == attribute.ranges()) {
105 return true;
106 }
107 break;
108
109 case Value::TEXT:
110 if (attr.text() == attribute.text()) {
111 return true;
112 }
113 break;
114
115 case Value::SET:
116 LOG(FATAL) << "Sets not supported for attributes";
117 }
118 }
119 }
120
121 return false;
122}
123
124
125Attribute Attributes::parse(const string& name, const string& text)

Callers 1

foreachFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected