Skip to content

Commit

Permalink
REMOVE redundant EntID class
Browse files Browse the repository at this point in the history
  • Loading branch information
fgalan committed Sep 4, 2024
1 parent f37e150 commit c3fe132
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 205 deletions.
2 changes: 0 additions & 2 deletions src/lib/apiTypesV2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ SET (SOURCES
Entities.cpp
Subscription.cpp
Registration.cpp
EntID.cpp
BatchQuery.cpp
BatchUpdate.cpp
HttpInfo.cpp
Expand All @@ -39,7 +38,6 @@ SET (HEADERS
Entities.h
Subscription.h
Registration.h
EntID.h
BatchQuery.h
BatchUpdate.h
CustomPayloadType.h
Expand Down
64 changes: 0 additions & 64 deletions src/lib/apiTypesV2/EntID.cpp

This file was deleted.

74 changes: 0 additions & 74 deletions src/lib/apiTypesV2/EntID.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/lib/apiTypesV2/Registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void Registration::setEntities(const orion::BSONObj& cr0)

for (unsigned int ix = 0; ix < dbEntityV.size(); ++ix)
{
ngsiv2::EntID entity;
EntityId entity;
orion::BSONObj ce = dbEntityV[ix].embeddedObject();

if (ce.hasField(REG_ENTITY_ISPATTERN))
Expand Down
4 changes: 2 additions & 2 deletions src/lib/apiTypesV2/Registration.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <string>
#include <vector>

#include "apiTypesV2/EntID.h"
#include "ngsi/EntityId.h"
#include "mongoDriver/BSONObj.h"


Expand Down Expand Up @@ -124,7 +124,7 @@ struct Provider
*/
struct DataProvided
{
std::vector<EntID> entities;
std::vector<EntityId> entities;
std::vector<std::string> attributes;

std::string toJson();
Expand Down
8 changes: 4 additions & 4 deletions src/lib/apiTypesV2/Subscription.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
#include <string>
#include <vector>

#include "apiTypesV2/EntID.h"
#include "apiTypesV2/HttpInfo.h"
#include "apiTypesV2/MqttInfo.h"
#include "apiTypesV2/SubscriptionExpression.h"
#include "ngsi/EntityId.h"
#include "ngsi/ScopeVector.h"
#include "common/RenderFormat.h"

Expand Down Expand Up @@ -136,9 +136,9 @@ struct Condition
*/
struct Subject
{
std::vector<EntID> entities;
Condition condition;
std::string toJson();
std::vector<EntityId> entities;
Condition condition;
std::string toJson();
};


Expand Down
4 changes: 2 additions & 2 deletions src/lib/cache/subCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ void subCacheItemInsert
const char* servicePath,
const ngsiv2::HttpInfo& httpInfo,
const ngsiv2::MqttInfo& mqttInfo,
const std::vector<ngsiv2::EntID>& entIdVector,
const std::vector<EntityId>& entIdVector,
const std::vector<std::string>& attributes,
const std::vector<std::string>& metadata,
const std::vector<std::string>& conditionAttrs,
Expand Down Expand Up @@ -918,7 +918,7 @@ void subCacheItemInsert
//
for (unsigned int ix = 0; ix < entIdVector.size(); ++ix)
{
const ngsiv2::EntID* eIdP = &entIdVector[ix];
const EntityId* eIdP = &entIdVector[ix];
std::string isPattern = (eIdP->id.empty())? "true" : "false";
bool isTypePattern = (eIdP->type.empty());
std::string id = (eIdP->id.empty())? eIdP->idPattern : eIdP->id;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/cache/subCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ extern void subCacheItemInsert
const char* servicePath,
const ngsiv2::HttpInfo& httpInfo,
const ngsiv2::MqttInfo& mqttInfo,
const std::vector<ngsiv2::EntID>& entities,
const std::vector<EntityId>& entities,
const std::vector<std::string>& attributes,
const std::vector<std::string>& metadata,
const std::vector<std::string>& conditionAttrs,
Expand Down
12 changes: 6 additions & 6 deletions src/lib/jsonParseV2/parseEntitiesVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "rest/ConnectionInfo.h"
#include "rest/OrionError.h"
#include "parse/forbiddenChars.h"
#include "apiTypesV2/EntID.h"
#include "ngsi/EntityId.h"
#include "common/string.h"
#include "common/errorMessages.h"
#include "jsonParseV2/utilsParse.h"
Expand All @@ -49,10 +49,10 @@
*/
bool parseEntitiesVector
(
ConnectionInfo* ciP,
std::vector<ngsiv2::EntID>* eivP,
const rapidjson::Value& entities,
std::string* errorStringP
ConnectionInfo* ciP,
std::vector<EntityId>* eivP,
const rapidjson::Value& entities,
std::string* errorStringP
)
{
if (!entities.IsArray())
Expand Down Expand Up @@ -209,7 +209,7 @@ bool parseEntitiesVector
}
}

ngsiv2::EntID eid(id, idPattern, type, typePattern);
EntityId eid(id, idPattern, type, typePattern);

if (std::find(eivP->begin(), eivP->end(), eid) == eivP->end()) // if not already included
{
Expand Down
10 changes: 5 additions & 5 deletions src/lib/jsonParseV2/parseEntitiesVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "rapidjson/document.h"

#include "rest/ConnectionInfo.h"
#include "apiTypesV2/EntID.h"
#include "ngsi/EntityId.h"



Expand All @@ -41,10 +41,10 @@
*/
extern bool parseEntitiesVector
(
ConnectionInfo* ciP,
std::vector<ngsiv2::EntID>* eivP,
const rapidjson::Value& entities,
std::string* errorStringP
ConnectionInfo* ciP,
std::vector<EntityId>* eivP,
const rapidjson::Value& entities,
std::string* errorStringP
);

#endif // SRC_LIB_JSONPARSEV2_PARSEENTITIESVECTOR_H_
2 changes: 1 addition & 1 deletion src/lib/jsonParseV2/parseRegistration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static bool dataProvidedParse
//
for (unsigned int eIx = 0; eIx < dataProvidedP->entities.size(); ++eIx)
{
ngsiv2::EntID* eP = &dataProvidedP->entities[eIx];
EntityId* eP = &dataProvidedP->entities[eIx];

if ((!eP->idPattern.empty()) && (eP->idPattern != ".*"))
{
Expand Down
1 change: 0 additions & 1 deletion src/lib/jsonParseV2/parseSubscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
* USING
*/
using ngsiv2::SubscriptionUpdate;
using ngsiv2::EntID;
using rapidjson::Value;


Expand Down
3 changes: 1 addition & 2 deletions src/lib/mongoBackend/MongoCommonSubscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
*/
using ngsiv2::Subscription;
using ngsiv2::HttpInfo;
using ngsiv2::EntID;



Expand Down Expand Up @@ -398,7 +397,7 @@ void setEntities(const Subscription& sub, orion::BSONObjBuilder* b)

for (unsigned int ix = 0; ix < sub.subject.entities.size(); ++ix)
{
EntID en = sub.subject.entities[ix];
EntityId en = sub.subject.entities[ix];
std::string finalId;
std::string finalType;
std::string isIdPattern;
Expand Down
7 changes: 3 additions & 4 deletions src/lib/mongoBackend/MongoGlobal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
* USING
*/
using ngsiv2::HttpInfo;
using ngsiv2::EntID;



Expand Down Expand Up @@ -401,7 +400,7 @@ void ensureDateExpirationIndex(const std::string& tenant)
* commutative: en1 is interpreted as the entity to match *in* en2 (i.e.
* it is assumed that the pattern is in en2)
*/
bool matchEntity(const EntityId* en1, const ngsiv2::EntID& en2)
bool matchEntity(const EntityId* en1, const EntityId& en2)
{
bool idMatch;

Expand All @@ -422,7 +421,7 @@ bool matchEntity(const EntityId* en1, const ngsiv2::EntID& en2)
regfree(&regex); // If regcomp fails it frees up itself (see glibc sources for details)
}
}
else /* isPattern == false */
else /* is not a pattern */
{
idMatch = (en2.id == en1->id);
}
Expand Down Expand Up @@ -2234,7 +2233,7 @@ void cprLookupByAttribute
/* Is there a matching entity in the Registration? */
for (unsigned enIx = 0; enIx < reg.dataProvided.entities.size(); ++enIx)
{
EntID regEn = reg.dataProvided.entities[enIx];
EntityId regEn = reg.dataProvided.entities[enIx];

if (regEn.idPattern == ".*")
{
Expand Down
2 changes: 1 addition & 1 deletion src/lib/mongoBackend/MongoGlobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ extern void ensureDateExpirationIndex(const std::string& tenant);
*
* matchEntity -
*/
extern bool matchEntity(const EntityId* en1, const ngsiv2::EntID& en2);
extern bool matchEntity(const EntityId* en1, const EntityId& en2);



Expand Down
3 changes: 1 addition & 2 deletions src/lib/mongoBackend/mongoGetSubscriptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
* USING -
*/
using ngsiv2::Subscription;
using ngsiv2::EntID;



Expand Down Expand Up @@ -94,7 +93,7 @@ static void setSubject(Subscription* s, const orion::BSONObj& r)
bool isTypePattern = ent.hasField(CSUB_ENTITY_ISTYPEPATTERN)?
getBoolFieldF(ent, CSUB_ENTITY_ISTYPEPATTERN) : false;

EntID en;
EntityId en;
if (isFalse(isPattern))
{
en.id = id;
Expand Down
Loading

0 comments on commit c3fe132

Please sign in to comment.