Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename src/app/interaction-model to src/app/data-model-interface and more updates on naming #33847

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ if (chip_build_tests) {
chip_test_group("tests") {
deps = []
tests = [
"${chip_root}/src/app/codegen-interaction-model/tests",
"${chip_root}/src/app/interaction-model/tests",
"${chip_root}/src/app/codegen-data-model/tests",
"${chip_root}/src/app/data-model-interface/tests",
"${chip_root}/src/access/tests",
"${chip_root}/src/crypto/tests",
"${chip_root}/src/inet/tests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <app/codegen-interaction-model/CodegenDataModel.h>
#include <app/codegen-data-model/CodegenDataModel.h>

#include <app-common/zap-generated/attribute-type.h>
#include <app/RequiredPrivilege.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
#pragma once

#include <app/interaction-model/Model.h>
#include <app/data-model-interface/DataModel.h>

#include <app/util/af-types.h>

Expand All @@ -35,7 +35,7 @@ namespace app {
/// Given that this relies on global data at link time, there generally can be
/// only one CodegenDataModel per application (you can create more instances,
/// however they would share the exact same underlying data and storage).
class CodegenDataModel : public chip::app::InteractionModel::Model
class CodegenDataModel : public chip::app::InteractionModel::DataModel
{
private:
/// Ember commands are stored as a `CommandId *` pointer that is either null (i.e. no commands)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import("//build_overrides/chip.gni")
# be cleanly built as a stand-alone and instead have to be imported as part of
# a different data model or compilation unit.
codegen_interaction_model_SOURCES = [
"${chip_root}/src/app/codegen-interaction-model/CodegenDataModel.h",
"${chip_root}/src/app/codegen-interaction-model/CodegenDataModel.cpp",
"${chip_root}/src/app/codegen-data-model/CodegenDataModel.h",
"${chip_root}/src/app/codegen-data-model/CodegenDataModel.cpp",
]

codegen_interaction_model_PUBLIC_DEPS = [
"${chip_root}/src/app/common:attribute-type",
"${chip_root}/src/app/interaction-model",
"${chip_root}/src/app/data-model-interface",
]
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
import("//build_overrides/chip.gni")
import("${chip_root}/build/chip/chip_test_suite.gni")
import("${chip_root}/src/app/codegen-interaction-model/model.gni")
import("${chip_root}/src/app/codegen-data-model/model.gni")

source_set("mock_model") {
sources = codegen_interaction_model_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <app/codegen-interaction-model/CodegenDataModel.h>
#include <app/codegen-data-model/CodegenDataModel.h>

#include <app/util/mock/Constants.h>
#include <app/util/mock/Functions.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
# limitations under the License.
import("//build_overrides/chip.gni")

source_set("interaction-model") {
source_set("data-model-interface") {
sources = [
"ActionContext.h",
"Context.h",
"Events.h",
"DataModel.h",
"DataModelChangeListener.h",
"EventsGenerator.h",
"InvokeResponder.h",
"MetadataTypes.cpp",
"MetadataTypes.h",
"Model.h",
"OperationTypes.h",
"Paths.h",
]

public_deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
#pragma once

#include <app/interaction-model/ActionContext.h>
#include <app/interaction-model/Events.h>
#include <app/interaction-model/Paths.h>
#include <app/data-model-interface/ActionContext.h>
#include <app/data-model-interface/DataModelChangeListener.h>
#include <app/data-model-interface/EventsGenerator.h>

namespace chip {
namespace app {
Expand All @@ -31,8 +31,8 @@ namespace InteractionModel {
/// as well as fetching current state (via actionContext)
struct InteractionModelContext
{
Events * events;
Paths * paths;
EventsGenerator * eventsGenerator;
DataModelChangeListener * dataModelChangeListener;
ActionContext * actionContext;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
#include <app/AttributeValueDecoder.h>
#include <app/AttributeValueEncoder.h>

#include <app/interaction-model/Context.h>
#include <app/interaction-model/InvokeResponder.h>
#include <app/interaction-model/MetadataTypes.h>
#include <app/interaction-model/OperationTypes.h>
#include <app/data-model-interface/Context.h>
#include <app/data-model-interface/InvokeResponder.h>
#include <app/data-model-interface/MetadataTypes.h>
#include <app/data-model-interface/OperationTypes.h>

namespace chip {
namespace app {
Expand All @@ -38,10 +38,10 @@ namespace InteractionModel {
/// thread or equivalent
/// - class is allowed to attempt to cache indexes/locations for faster
/// lookups of things (e.g during iterations)
class Model : public DataModelMetadataTree
class DataModel : public DataModelMetadataTree
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So here is a question: why do we have InteractionModel::DataModel? These are sort of orthogonal things....

{
public:
virtual ~Model() = default;
virtual ~DataModel() = default;

// `context` pointers will be guaranteed valid until Shutdown is called()
virtual CHIP_ERROR Startup(InteractionModelContext context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,19 @@ namespace chip {
namespace app {
namespace InteractionModel {

/// Notification listener for attribute changes.
/// Notification listener for changes of the underlying data in a
/// data model.
///
/// Used to notify that a specific attribute path (or several attributes
/// via wildcards) have changed their underlying content.
///
/// Methods on this class MUST be called from within the matter
/// main loop as they will likely trigger interaction model
/// internal updates and subscription data reporting.
class Paths
class DataModelChangeListener
{
public:
virtual ~Paths() = 0;
virtual ~DataModelChangeListener() = 0;

/// Mark all attributes matching the given path (which may be a wildcard) dirty.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ std::optional<EventNumber> GenerateEvent(G & generator, const T & aEventData, En

} // namespace internal

/// Exposes event access capabilities.
/// Exposes event generation capabilities.
///
/// Allows callers to "generate events" which effectively notifies of an event having
/// ocurred.
class Events
class EventsGenerator
{
public:
virtual ~Events() = default;
virtual ~EventsGenerator() = default;

/// Generates the given event.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <app/interaction-model/MetadataTypes.h>
#include <app/data-model-interface/MetadataTypes.h>

namespace chip {
namespace app {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ chip_test_suite("tests") {

cflags = [ "-Wconversion" ]

public_deps = [ "${chip_root}/src/app/interaction-model" ]
public_deps = [ "${chip_root}/src/app/data-model-interface" ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*/

#include <app-common/zap-generated/cluster-objects.h>
#include <app/data-model-interface/EventsGenerator.h>
#include <app/data-model/Decode.h>
#include <app/interaction-model/Events.h>
#include <lib/support/CodeUtils.h>

#include <gtest/gtest.h>
Expand All @@ -36,7 +36,7 @@ constexpr uint32_t kFakeSoftwareVersion = 0x1234abcd;

/// Keeps the "last event" in-memory to allow tests to validate
/// that event writing and encoding worked.
class LogOnlyEvents : public Events
class LogOnlyEvents : public EventsGenerator
{
public:
CHIP_ERROR GenerateEvent(EventLoggingDelegate * eventContentWriter, const EventOptions & options,
Expand Down Expand Up @@ -96,7 +96,7 @@ class LogOnlyEvents : public Events
TEST(TestInteractionModelEventEmitting, TestBasicType)
{
LogOnlyEvents logOnlyEvents;
Events * events = &logOnlyEvents;
EventsGenerator * events = &logOnlyEvents;

StartUpEventType event{ kFakeSoftwareVersion };

Expand Down Expand Up @@ -131,7 +131,7 @@ TEST(TestInteractionModelEventEmitting, TestFabricScoped)
static_assert(kTestFabricIndex != kUndefinedFabricIndex);

LogOnlyEvents logOnlyEvents;
Events * events = &logOnlyEvents;
EventsGenerator * events = &logOnlyEvents;

AccessControlEntryChangedType event;
event.adminNodeID = chip::app::DataModel::MakeNullable(kTestNodeId);
Expand Down
Loading