Skip to content

Commit a3d0a86

Browse files
authored
Add more files to be managed and known by GN (project-chip#32140)
* A first attempt at cleanup: moved ObjectList.h and some renames * Another rename pass * Final rename pass * Restyle * Fix typo in include * Fix typo and include dependencies * Remove handled files from linter check * Added 3 more mock files to be tracked by gn * Added some comments about layering issues and added EventManagement.h since that seems safe * Added more headers that are safe and restyle * Spell out what we could not add in IM because broken dependencies * Also track AppDelegate * Update the comments to not trigger the very basic linter we have * Fix typo * Restyle * Pull linkedlist into support rather than separate source set
1 parent 6b27278 commit a3d0a86

26 files changed

+132
-104
lines changed

.github/workflows/lint.yml

-14
Original file line numberDiff line numberDiff line change
@@ -93,35 +93,25 @@ jobs:
9393
--known-failure app/AttributeAccessInterface.h \
9494
--known-failure app/AttributeAccessToken.h \
9595
--known-failure app/att-storage.h \
96-
--known-failure app/BufferedReadCallback.h \
9796
--known-failure app/CommandHandler.h \
9897
--known-failure app/CommandHandlerInterface.h \
99-
--known-failure app/CommandPathParams.h \
100-
--known-failure app/CommandPathRegistry.h \
101-
--known-failure app/CommandResponseSender.h \
10298
--known-failure app/CommandSender.h \
10399
--known-failure app/CommandSenderLegacyCallback.h \
104100
--known-failure app/CompatEnumNames.h \
105-
--known-failure app/ConcreteAttributePath.h \
106-
--known-failure app/ConcreteCommandPath.h \
107101
--known-failure app/data-model/ListLargeSystemExtensions.h \
108102
--known-failure app/EventHeader.h \
109103
--known-failure app/EventLoggingDelegate.h \
110104
--known-failure app/EventLogging.h \
111105
--known-failure app/EventLoggingTypes.h \
112-
--known-failure app/EventManagement.h \
113106
--known-failure app/InteractionModelHelper.h \
114-
--known-failure app/ObjectList.h \
115107
--known-failure app/ReadClient.h \
116108
--known-failure app/ReadHandler.h \
117109
--known-failure app/ReadPrepareParams.h \
118110
--known-failure app/reporting/tests/MockReportScheduler.cpp \
119111
--known-failure app/reporting/tests/MockReportScheduler.h \
120-
--known-failure app/server/AppDelegate.h \
121112
--known-failure app/TestEventTriggerDelegate.h \
122113
--known-failure app/util/af.h \
123114
--known-failure app/util/af-types.h \
124-
--known-failure app/util/attribute-metadata.h \
125115
--known-failure app/util/attribute-storage.cpp \
126116
--known-failure app/util/attribute-storage.h \
127117
--known-failure app/util/attribute-storage-null-handling.h \
@@ -141,11 +131,7 @@ jobs:
141131
--known-failure app/util/im-client-callbacks.h \
142132
--known-failure app/util/MatterCallbacks.h \
143133
--known-failure app/util/message.cpp \
144-
--known-failure app/util/mock/Constants.h \
145-
--known-failure app/util/mock/Functions.h \
146-
--known-failure app/util/mock/MockNodeConfig.h \
147134
--known-failure app/util/odd-sized-integers.h \
148-
--known-failure app/util/types_stub.h \
149135
--known-failure app/util/util.cpp \
150136
--known-failure app/util/util.h \
151137
--known-failure app/WriteClient.h \

src/app/AttributePathExpandIterator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ extern bool emberAfEndpointIndexIsEnabled(uint16_t index);
5252
namespace chip {
5353
namespace app {
5454

55-
AttributePathExpandIterator::AttributePathExpandIterator(ObjectList<AttributePathParams> * aAttributePath)
55+
AttributePathExpandIterator::AttributePathExpandIterator(SingleLinkedListNode<AttributePathParams> * aAttributePath)
5656
{
5757
mpAttributePath = aAttributePath;
5858

src/app/AttributePathExpandIterator.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ namespace app {
6969
class AttributePathExpandIterator
7070
{
7171
public:
72-
AttributePathExpandIterator(ObjectList<AttributePathParams> * aAttributePath);
72+
AttributePathExpandIterator(SingleLinkedListNode<AttributePathParams> * aAttributePath);
7373

7474
/**
7575
* Proceed the iterator to the next attribute path in the given cluster info.
@@ -105,7 +105,7 @@ class AttributePathExpandIterator
105105
inline bool Valid() const { return mpAttributePath != nullptr; }
106106

107107
private:
108-
ObjectList<AttributePathParams> * mpAttributePath;
108+
SingleLinkedListNode<AttributePathParams> * mpAttributePath;
109109

110110
ConcreteAttributePath mOutputPath;
111111

src/app/BUILD.gn

+26
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ source_set("revision_info") {
8787
source_set("paths") {
8888
sources = [
8989
"AttributePathParams.h",
90+
"CommandPathParams.h",
91+
"CommandPathRegistry.h",
92+
"ConcreteAttributePath.h",
9093
"ConcreteClusterPath.h",
94+
"ConcreteCommandPath.h",
9195
"ConcreteEventPath.h",
9296
"DataVersionFilter.h",
9397
"EventPathParams.h",
@@ -96,6 +100,7 @@ source_set("paths") {
96100
# This source sets also depends on basic-types.h that is not in any dependency we can use
97101
public_deps = [
98102
":app_config",
103+
"${chip_root}/src/app/util:types",
99104
"${chip_root}/src/lib/core",
100105
"${chip_root}/src/lib/core:types",
101106
]
@@ -222,12 +227,14 @@ static_library("app") {
222227
"CommandHandler.cpp",
223228
"CommandResponseHelper.h",
224229
"CommandResponseSender.cpp",
230+
"CommandResponseSender.h",
225231
"CommandSender.cpp",
226232
"DefaultAttributePersistenceProvider.cpp",
227233
"DefaultAttributePersistenceProvider.h",
228234
"DeferredAttributePersistenceProvider.cpp",
229235
"DeferredAttributePersistenceProvider.h",
230236
"EventManagement.cpp",
237+
"EventManagement.h",
231238
"FailSafeContext.cpp",
232239
"FailSafeContext.h",
233240
"OTAUserConsentCommon.h",
@@ -242,6 +249,21 @@ static_library("app") {
242249
"TimerDelegates.h",
243250
"WriteClient.cpp",
244251
"WriteHandler.cpp",
252+
253+
# TODO: the following items cannot be included due to interaction-model circularity
254+
# (app depending on im and im including these headers):
255+
# Name with _ so that linter does not recognize it
256+
# "CommandHandler._h"
257+
# "CommandSender._h",
258+
# "ReadClient._h",
259+
# "ReadHandler._h",
260+
# "WriteClient._h",
261+
# "WriteHandler._h"
262+
263+
# TODO: the following items cannot be included due to platform includes not being
264+
# able to depend on src/app
265+
# Name with _ so that linter does not recognize it
266+
# "_AttributeAccessInterface._h",
245267
]
246268

247269
public_deps = [
@@ -261,9 +283,13 @@ static_library("app") {
261283
if (chip_enable_read_client) {
262284
sources += [
263285
"BufferedReadCallback.cpp",
286+
"BufferedReadCallback.h",
264287
"ClusterStateCache.cpp",
265288
"ClusterStateCache.h",
266289
"ReadClient.cpp",
290+
291+
# TODO: cannot include "ReadClient._h" because interaction-model backreference
292+
# Name with _ so that linter does not recognize it
267293
]
268294
}
269295

src/app/EventLoggingTypes.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919

2020
#include <access/SubjectDescriptor.h>
2121
#include <app/EventPathParams.h>
22-
#include <app/ObjectList.h>
2322
#include <app/util/basic-types.h>
2423
#include <lib/core/CHIPCore.h>
2524
#include <lib/core/Optional.h>
2625
#include <lib/core/TLV.h>
26+
#include <lib/support/LinkedList.h>
2727
#include <system/SystemPacketBuffer.h>
2828

2929
inline constexpr size_t kNumPriorityLevel = 3;
@@ -151,10 +151,10 @@ struct EventLoadOutContext
151151
EventNumber mStartingEventNumber = 0;
152152
Timestamp mPreviousTime;
153153
Timestamp mCurrentTime;
154-
EventNumber mCurrentEventNumber = 0;
155-
size_t mEventCount = 0;
156-
const ObjectList<EventPathParams> * mpInterestedEventPaths = nullptr;
157-
bool mFirst = true;
154+
EventNumber mCurrentEventNumber = 0;
155+
size_t mEventCount = 0;
156+
const SingleLinkedListNode<EventPathParams> * mpInterestedEventPaths = nullptr;
157+
bool mFirst = true;
158158
Access::SubjectDescriptor mSubjectDescriptor;
159159
};
160160
} // namespace app

src/app/EventManagement.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ CHIP_ERROR EventManagement::CopyEventsSince(const TLVReader & aReader, size_t aD
639639
return err;
640640
}
641641

642-
CHIP_ERROR EventManagement::FetchEventsSince(TLVWriter & aWriter, const ObjectList<EventPathParams> * apEventPathList,
642+
CHIP_ERROR EventManagement::FetchEventsSince(TLVWriter & aWriter, const SingleLinkedListNode<EventPathParams> * apEventPathList,
643643
EventNumber & aEventMin, size_t & aEventCount,
644644
const Access::SubjectDescriptor & aSubjectDescriptor)
645645
{

src/app/EventManagement.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
#include <access/SubjectDescriptor.h>
3232
#include <app/MessageDef/EventDataIB.h>
3333
#include <app/MessageDef/StatusIB.h>
34-
#include <app/ObjectList.h>
3534
#include <app/util/basic-types.h>
3635
#include <lib/core/TLVCircularBuffer.h>
3736
#include <lib/support/CHIPCounter.h>
37+
#include <lib/support/LinkedList.h>
3838
#include <messaging/ExchangeMgr.h>
3939
#include <platform/CHIPDeviceConfig.h>
4040
#include <system/SystemClock.h>
@@ -359,7 +359,7 @@ class EventManagement
359359
* available.
360360
*
361361
*/
362-
CHIP_ERROR FetchEventsSince(chip::TLV::TLVWriter & aWriter, const ObjectList<EventPathParams> * apEventPathList,
362+
CHIP_ERROR FetchEventsSince(chip::TLV::TLVWriter & aWriter, const SingleLinkedListNode<EventPathParams> * apEventPathList,
363363
EventNumber & aEventMin, size_t & aEventCount,
364364
const Access::SubjectDescriptor & aSubjectDescriptor);
365365
/**

src/app/InteractionModelEngine.cpp

+17-15
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ CHIP_ERROR InteractionModelEngine::ParseAttributePaths(const Access::SubjectDesc
450450
// This avoids the 'parse all paths' approach that is employed in ReadHandler since we want to
451451
// avoid allocating out of the path store during this minimal initial processing stage.
452452
//
453-
ObjectList<AttributePathParams> paramsList;
453+
SingleLinkedListNode<AttributePathParams> paramsList;
454454

455455
ReturnErrorOnFailure(path.Init(pathReader));
456456
ReturnErrorOnFailure(path.ParsePath(paramsList.mValue));
@@ -1513,12 +1513,12 @@ bool InteractionModelEngine::HasConflictWriteRequests(const WriteHandler * apWri
15131513
return false;
15141514
}
15151515

1516-
void InteractionModelEngine::ReleaseAttributePathList(ObjectList<AttributePathParams> *& aAttributePathList)
1516+
void InteractionModelEngine::ReleaseAttributePathList(SingleLinkedListNode<AttributePathParams> *& aAttributePathList)
15171517
{
15181518
ReleasePool(aAttributePathList, mAttributePathPool);
15191519
}
15201520

1521-
CHIP_ERROR InteractionModelEngine::PushFrontAttributePathList(ObjectList<AttributePathParams> *& aAttributePathList,
1521+
CHIP_ERROR InteractionModelEngine::PushFrontAttributePathList(SingleLinkedListNode<AttributePathParams> *& aAttributePathList,
15221522
AttributePathParams & aAttributePath)
15231523
{
15241524
CHIP_ERROR err = PushFront(aAttributePathList, aAttributePath, mAttributePathPool);
@@ -1530,10 +1530,10 @@ CHIP_ERROR InteractionModelEngine::PushFrontAttributePathList(ObjectList<Attribu
15301530
return err;
15311531
}
15321532

1533-
void InteractionModelEngine::RemoveDuplicateConcreteAttributePath(ObjectList<AttributePathParams> *& aAttributePaths)
1533+
void InteractionModelEngine::RemoveDuplicateConcreteAttributePath(SingleLinkedListNode<AttributePathParams> *& aAttributePaths)
15341534
{
1535-
ObjectList<AttributePathParams> * prev = nullptr;
1536-
auto * path1 = aAttributePaths;
1535+
SingleLinkedListNode<AttributePathParams> * prev = nullptr;
1536+
auto * path1 = aAttributePaths;
15371537

15381538
while (path1 != nullptr)
15391539
{
@@ -1585,12 +1585,12 @@ void InteractionModelEngine::RemoveDuplicateConcreteAttributePath(ObjectList<Att
15851585
}
15861586
}
15871587

1588-
void InteractionModelEngine::ReleaseEventPathList(ObjectList<EventPathParams> *& aEventPathList)
1588+
void InteractionModelEngine::ReleaseEventPathList(SingleLinkedListNode<EventPathParams> *& aEventPathList)
15891589
{
15901590
ReleasePool(aEventPathList, mEventPathPool);
15911591
}
15921592

1593-
CHIP_ERROR InteractionModelEngine::PushFrontEventPathParamsList(ObjectList<EventPathParams> *& aEventPathList,
1593+
CHIP_ERROR InteractionModelEngine::PushFrontEventPathParamsList(SingleLinkedListNode<EventPathParams> *& aEventPathList,
15941594
EventPathParams & aEventPath)
15951595
{
15961596
CHIP_ERROR err = PushFront(aEventPathList, aEventPath, mEventPathPool);
@@ -1602,12 +1602,12 @@ CHIP_ERROR InteractionModelEngine::PushFrontEventPathParamsList(ObjectList<Event
16021602
return err;
16031603
}
16041604

1605-
void InteractionModelEngine::ReleaseDataVersionFilterList(ObjectList<DataVersionFilter> *& aDataVersionFilterList)
1605+
void InteractionModelEngine::ReleaseDataVersionFilterList(SingleLinkedListNode<DataVersionFilter> *& aDataVersionFilterList)
16061606
{
16071607
ReleasePool(aDataVersionFilterList, mDataVersionFilterPool);
16081608
}
16091609

1610-
CHIP_ERROR InteractionModelEngine::PushFrontDataVersionFilterList(ObjectList<DataVersionFilter> *& aDataVersionFilterList,
1610+
CHIP_ERROR InteractionModelEngine::PushFrontDataVersionFilterList(SingleLinkedListNode<DataVersionFilter> *& aDataVersionFilterList,
16111611
DataVersionFilter & aDataVersionFilter)
16121612
{
16131613
CHIP_ERROR err = PushFront(aDataVersionFilterList, aDataVersionFilter, mDataVersionFilterPool);
@@ -1620,12 +1620,13 @@ CHIP_ERROR InteractionModelEngine::PushFrontDataVersionFilterList(ObjectList<Dat
16201620
}
16211621

16221622
template <typename T, size_t N>
1623-
void InteractionModelEngine::ReleasePool(ObjectList<T> *& aObjectList, ObjectPool<ObjectList<T>, N> & aObjectPool)
1623+
void InteractionModelEngine::ReleasePool(SingleLinkedListNode<T> *& aObjectList,
1624+
ObjectPool<SingleLinkedListNode<T>, N> & aObjectPool)
16241625
{
1625-
ObjectList<T> * current = aObjectList;
1626+
SingleLinkedListNode<T> * current = aObjectList;
16261627
while (current != nullptr)
16271628
{
1628-
ObjectList<T> * nextObject = current->mpNext;
1629+
SingleLinkedListNode<T> * nextObject = current->mpNext;
16291630
aObjectPool.ReleaseObject(current);
16301631
current = nextObject;
16311632
}
@@ -1634,9 +1635,10 @@ void InteractionModelEngine::ReleasePool(ObjectList<T> *& aObjectList, ObjectPoo
16341635
}
16351636

16361637
template <typename T, size_t N>
1637-
CHIP_ERROR InteractionModelEngine::PushFront(ObjectList<T> *& aObjectList, T & aData, ObjectPool<ObjectList<T>, N> & aObjectPool)
1638+
CHIP_ERROR InteractionModelEngine::PushFront(SingleLinkedListNode<T> *& aObjectList, T & aData,
1639+
ObjectPool<SingleLinkedListNode<T>, N> & aObjectPool)
16381640
{
1639-
ObjectList<T> * object = aObjectPool.CreateObject();
1641+
SingleLinkedListNode<T> * object = aObjectPool.CreateObject();
16401642
if (object == nullptr)
16411643
{
16421644
return CHIP_ERROR_NO_MEMORY;

src/app/InteractionModelEngine.h

+13-13
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include <app/EventPathParams.h>
3939
#include <app/MessageDef/AttributeReportIBs.h>
4040
#include <app/MessageDef/ReportDataMessage.h>
41-
#include <app/ObjectList.h>
4241
#include <app/ReadClient.h>
4342
#include <app/ReadHandler.h>
4443
#include <app/StatusResponse.h>
@@ -54,6 +53,7 @@
5453
#include <lib/core/CHIPCore.h>
5554
#include <lib/support/CodeUtils.h>
5655
#include <lib/support/DLLUtil.h>
56+
#include <lib/support/LinkedList.h>
5757
#include <lib/support/Pool.h>
5858
#include <lib/support/logging/CHIPLogging.h>
5959
#include <messaging/ExchangeContext.h>
@@ -187,22 +187,22 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler,
187187

188188
reporting::ReportScheduler * GetReportScheduler() { return mReportScheduler; }
189189

190-
void ReleaseAttributePathList(ObjectList<AttributePathParams> *& aAttributePathList);
190+
void ReleaseAttributePathList(SingleLinkedListNode<AttributePathParams> *& aAttributePathList);
191191

192-
CHIP_ERROR PushFrontAttributePathList(ObjectList<AttributePathParams> *& aAttributePathList,
192+
CHIP_ERROR PushFrontAttributePathList(SingleLinkedListNode<AttributePathParams> *& aAttributePathList,
193193
AttributePathParams & aAttributePath);
194194

195195
// If a concrete path indicates an attribute that is also referenced by a wildcard path in the request,
196196
// the path SHALL be removed from the list.
197-
void RemoveDuplicateConcreteAttributePath(ObjectList<AttributePathParams> *& aAttributePaths);
197+
void RemoveDuplicateConcreteAttributePath(SingleLinkedListNode<AttributePathParams> *& aAttributePaths);
198198

199-
void ReleaseEventPathList(ObjectList<EventPathParams> *& aEventPathList);
199+
void ReleaseEventPathList(SingleLinkedListNode<EventPathParams> *& aEventPathList);
200200

201-
CHIP_ERROR PushFrontEventPathParamsList(ObjectList<EventPathParams> *& aEventPathList, EventPathParams & aEventPath);
201+
CHIP_ERROR PushFrontEventPathParamsList(SingleLinkedListNode<EventPathParams> *& aEventPathList, EventPathParams & aEventPath);
202202

203-
void ReleaseDataVersionFilterList(ObjectList<DataVersionFilter> *& aDataVersionFilterList);
203+
void ReleaseDataVersionFilterList(SingleLinkedListNode<DataVersionFilter> *& aDataVersionFilterList);
204204

205-
CHIP_ERROR PushFrontDataVersionFilterList(ObjectList<DataVersionFilter> *& aDataVersionFilterList,
205+
CHIP_ERROR PushFrontDataVersionFilterList(SingleLinkedListNode<DataVersionFilter> *& aDataVersionFilterList,
206206
DataVersionFilter & aDataVersionFilter);
207207

208208
CHIP_ERROR RegisterCommandHandler(CommandHandlerInterface * handler);
@@ -576,9 +576,9 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler,
576576
static void ResumeSubscriptionsTimerCallback(System::Layer * apSystemLayer, void * apAppState);
577577

578578
template <typename T, size_t N>
579-
void ReleasePool(ObjectList<T> *& aObjectList, ObjectPool<ObjectList<T>, N> & aObjectPool);
579+
void ReleasePool(SingleLinkedListNode<T> *& aObjectList, ObjectPool<SingleLinkedListNode<T>, N> & aObjectPool);
580580
template <typename T, size_t N>
581-
CHIP_ERROR PushFront(ObjectList<T> *& aObjectList, T & aData, ObjectPool<ObjectList<T>, N> & aObjectPool);
581+
CHIP_ERROR PushFront(SingleLinkedListNode<T> *& aObjectList, T & aData, ObjectPool<SingleLinkedListNode<T>, N> & aObjectPool);
582582

583583
Messaging::ExchangeManager * mpExchangeMgr = nullptr;
584584

@@ -606,13 +606,13 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler,
606606
"CHIP_IM_MAX_NUM_READS is too small to match the requirements of spec 8.5.1");
607607
#endif
608608

609-
ObjectPool<ObjectList<AttributePathParams>,
609+
ObjectPool<SingleLinkedListNode<AttributePathParams>,
610610
CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_READS + CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_SUBSCRIPTIONS>
611611
mAttributePathPool;
612-
ObjectPool<ObjectList<EventPathParams>,
612+
ObjectPool<SingleLinkedListNode<EventPathParams>,
613613
CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_READS + CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_SUBSCRIPTIONS>
614614
mEventPathPool;
615-
ObjectPool<ObjectList<DataVersionFilter>,
615+
ObjectPool<SingleLinkedListNode<DataVersionFilter>,
616616
CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_READS + CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS_FOR_SUBSCRIPTIONS>
617617
mDataVersionFilterPool;
618618

src/app/ReadHandler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void ReadHandler::OnSubscriptionResumed(const SessionHandle & sessionHandle,
134134

135135
MoveToState(HandlerState::CanStartReporting);
136136

137-
ObjectList<AttributePathParams> * attributePath = mpAttributePathList;
137+
SingleLinkedListNode<AttributePathParams> * attributePath = mpAttributePathList;
138138
while (attributePath)
139139
{
140140
mManagementCallback.GetInteractionModelEngine()->GetReportingEngine().SetDirty(attributePath->mValue);

0 commit comments

Comments
 (0)