Skip to content

Commit

Permalink
REMOVE Restriction class
Browse files Browse the repository at this point in the history
  • Loading branch information
fgalan committed Aug 13, 2024
1 parent c0e1a25 commit b984341
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 329 deletions.
8 changes: 4 additions & 4 deletions src/lib/apiTypesV2/Subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@ namespace ngsiv2
*/
Subscription::~Subscription()
{
unsigned int sz = restriction.scopeVector.size();
unsigned int sz = scopeVector.size();

if (sz > 0)
{
for (unsigned i = 0; i != sz; i++ )
{
restriction.scopeVector[i]->release();
delete restriction.scopeVector[i];
scopeVector[i]->release();
delete scopeVector[i];
}
restriction.scopeVector.vec.clear();
scopeVector.vec.clear();
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/apiTypesV2/Subscription.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "apiTypesV2/HttpInfo.h"
#include "apiTypesV2/MqttInfo.h"
#include "apiTypesV2/SubscriptionExpression.h"
#include "ngsi/Restriction.h"
#include "ngsi/ScopeVector.h"
#include "common/RenderFormat.h"

namespace ngsiv2
Expand Down Expand Up @@ -159,7 +159,7 @@ class Subscription
Notification notification;
long long throttling;
RenderFormat attrsFormat;
Restriction restriction;
ScopeVector scopeVector;
std::string toJson();
void release();

Expand Down
2 changes: 1 addition & 1 deletion src/lib/jsonParseV2/parseSubscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ static std::string parseNotifyConditionVector
// Expression
if (condition.HasMember("expression"))
{
std::string r = parseExpression(condition["expression"], &subsP->restriction.scopeVector, subsP);
std::string r = parseExpression(condition["expression"], &subsP->scopeVector, subsP);

if (r != "OK")
{
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 @@ -49,7 +49,6 @@
#include "ngsi/EntityIdVector.h"
#include "ngsi/StringList.h"
#include "ngsi/ContextElementResponseVector.h"
#include "ngsi/Restriction.h"
#include "ngsiNotify/Notifier.h"
#include "rest/StringFilter.h"
#include "apiTypesV2/Subscription.h"
Expand Down Expand Up @@ -1252,7 +1251,7 @@ bool entitiesQuery
(
const EntityIdVector& enV,
const StringList& attrL,
const Restriction& res,
const ScopeVector& spV,
ContextElementResponseVector* cerV,
std::string* err,
const std::string& tenant,
Expand Down Expand Up @@ -1350,9 +1349,9 @@ bool entitiesQuery
std::vector<orion::BSONObj> filters;
unsigned int geoScopes = 0;

for (unsigned int ix = 0; ix < res.scopeVector.size(); ++ix)
for (unsigned int ix = 0; ix < spV.size(); ++ix)
{
const Scope* scopeP = res.scopeVector[ix];
const Scope* scopeP = spV[ix];

if (scopeP->type.find(SCOPE_FILTER) == 0)
{
Expand Down
3 changes: 1 addition & 2 deletions src/lib/mongoBackend/MongoGlobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "ngsi/StringList.h"
#include "ngsi/ContextElementResponseVector.h"
#include "ngsi/ContextRegistrationResponseVector.h"
#include "ngsi/Restriction.h"
#include "ngsi10/UpdateContextResponse.h"
#include "ngsiNotify/Notifier.h"
#include "rest/uriParamNames.h"
Expand Down Expand Up @@ -215,7 +214,7 @@ extern bool entitiesQuery
(
const EntityIdVector& enV,
const StringList& attrL,
const Restriction& res,
const ScopeVector& spV,
ContextElementResponseVector* cerV,
std::string* err,
const std::string& tenant,
Expand Down
12 changes: 6 additions & 6 deletions src/lib/mongoBackend/mongoCreateSubscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,22 @@ static void insertInCache
//
// StringFilter in Scope?
//
// Any Scope of type SCOPE_TYPE_SIMPLE_QUERY sub.restriction.scopeVector?
// Any Scope of type SCOPE_TYPE_SIMPLE_QUERY sub.scopeVector?
// If so, set it as string filter to the sub-cache item
//
StringFilter* stringFilterP = NULL;
StringFilter* mdStringFilterP = NULL;

for (unsigned int ix = 0; ix < sub.restriction.scopeVector.size(); ++ix)
for (unsigned int ix = 0; ix < sub.scopeVector.size(); ++ix)
{
if (sub.restriction.scopeVector[ix]->type == SCOPE_TYPE_SIMPLE_QUERY)
if (sub.scopeVector[ix]->type == SCOPE_TYPE_SIMPLE_QUERY)
{
stringFilterP = sub.restriction.scopeVector[ix]->stringFilterP;
stringFilterP = sub.scopeVector[ix]->stringFilterP;
}

if (sub.restriction.scopeVector[ix]->type == SCOPE_TYPE_SIMPLE_QUERY_MD)
if (sub.scopeVector[ix]->type == SCOPE_TYPE_SIMPLE_QUERY_MD)
{
mdStringFilterP = sub.restriction.scopeVector[ix]->mdStringFilterP;
mdStringFilterP = sub.scopeVector[ix]->mdStringFilterP;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/mongoBackend/mongoQueryContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ HttpStatusCode mongoQueryContext

ok = entitiesQuery(requestP->entityIdVector,
requestP->attributeList,
requestP->restriction,
requestP->scopeVector,
&rawCerV,
&err,
tenant,
Expand Down
12 changes: 6 additions & 6 deletions src/lib/mongoBackend/mongoUpdateSubscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,22 +149,22 @@ static void updateInCache
//
// StringFilter in Scope?
//
// Any Scope of type SCOPE_TYPE_SIMPLE_QUERY in subUp.restriction.scopeVector?
// Any Scope of type SCOPE_TYPE_SIMPLE_QUERY in subUp.scopeVector?
// If so, set it as string filter to the sub-cache item
//
StringFilter* stringFilterP = NULL;
StringFilter* mdStringFilterP = NULL;

for (unsigned int ix = 0; ix < subUp.restriction.scopeVector.size(); ++ix)
for (unsigned int ix = 0; ix < subUp.scopeVector.size(); ++ix)
{
if (subUp.restriction.scopeVector[ix]->type == SCOPE_TYPE_SIMPLE_QUERY)
if (subUp.scopeVector[ix]->type == SCOPE_TYPE_SIMPLE_QUERY)
{
stringFilterP = subUp.restriction.scopeVector[ix]->stringFilterP;
stringFilterP = subUp.scopeVector[ix]->stringFilterP;
}

if (subUp.restriction.scopeVector[ix]->type == SCOPE_TYPE_SIMPLE_QUERY_MD)
if (subUp.scopeVector[ix]->type == SCOPE_TYPE_SIMPLE_QUERY_MD)
{
mdStringFilterP = subUp.restriction.scopeVector[ix]->mdStringFilterP;
mdStringFilterP = subUp.scopeVector[ix]->mdStringFilterP;
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/lib/ngsi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ SET (SOURCES
MetadataVector.cpp
ProvidingApplication.cpp
Request.cpp
Restriction.cpp
Scope.cpp
ScopeVector.cpp
StatusCode.cpp
Expand All @@ -58,7 +57,6 @@ SET (HEADERS
Metadata.h
MetadataVector.h
ProvidingApplication.h
Restriction.h
Scope.h
StatusCode.h
StringList.h
Expand Down
50 changes: 0 additions & 50 deletions src/lib/ngsi/ResponseData.h

This file was deleted.

93 changes: 0 additions & 93 deletions src/lib/ngsi/Restriction.cpp

This file was deleted.

50 changes: 0 additions & 50 deletions src/lib/ngsi/Restriction.h

This file was deleted.

Loading

0 comments on commit b984341

Please sign in to comment.