Skip to content

Commit

Permalink
renamed '*MetaData()' to '*Entry()' in MetaData class
Browse files Browse the repository at this point in the history
  • Loading branch information
grnydawn committed Feb 7, 2024
1 parent bd83765 commit c6c083f
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 134 deletions.
12 changes: 6 additions & 6 deletions components/omega/doc/design/Metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ the code, simulation, file metadata, but also for variables if additional
metadata is desired.
```c++
int addMetaData(const std::string MetaName, /// Name of new metadata to add
int addEntry(const std::string MetaName, /// Name of new metadata to add
const std::any Value /// Value of new metadata to add
);
```
Expand All @@ -280,7 +280,7 @@ For symmetry, we will supply a remove function, though the
use case is likely rare.

```c++
int removeMetaData(const std::string MetaName /// Name of metadata to remove
int removeEntry(const std::string MetaName /// Name of metadata to remove
);
```
Expand All @@ -290,7 +290,7 @@ The most common use case will be retrieving metadata. For a single
metadata entry, there will be an explicit get function:
```c++
int getMetaData(const std::string MetaName, /// Name of metadata to get
int getEntry(const std::string MetaName, /// Name of metadata to get
I4 &Value /// I4 Value of metadata
);
```
Expand All @@ -309,8 +309,8 @@ example, to retrieve all metadata from a defined field:

```c++
auto MyVar = MetaData::create("MyVar");
MyVar->addMetaData("Name", 1);
std::map<std::string, std::any> *VarMeta = MyVar->getAllMetaData();
MyVar->addEntry("Name", 1);
std::map<std::string, std::any> *VarMeta = MyVar->getAllEntries();
std::string MetaName;
std::any MetaVal;

Expand Down Expand Up @@ -375,7 +375,7 @@ For metadata, a function will be provided to inquire whether metadata
with a given name have already been defined:
```c++
bool Metadata::hasMetaData(const std::string Name);
bool Metadata::hasEntry(const std::string Name);
```

#### 4.2.7 Metadata groups
Expand Down
24 changes: 12 additions & 12 deletions components/omega/doc/devGuide/MetaData.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ variables they interact with. Function names begin with a lowercase letter.
to instantiate a MetaData class.
- **Non-Static Member Access**: Functions dealing with non-static members often
conclude with a specific descriptor indicating the targeted
information, e.g., `getMetaData("Name", Var);` retrieves
information, e.g., `getEntry("Name", Var);` retrieves
metadata from a MetaData instance.
- **Instance Management**: The terms `create/destroy` are designated for
functions that instantiate or delete an instance, respectively.
Expand Down Expand Up @@ -150,12 +150,12 @@ other reasons.

## Add/Remove a Metadata to/from a MetaData Instance

To add metadata to a `MetaData` instance, the `addMetaData` function is used:
To add metadata to a `MetaData` instance, the `addEntry` function is used:

```
int ret;
const R8 AValue = 2.0;
ret = Data1->addMetaData("NewMeta", AValue);
ret = Data1->addEntry("NewMeta", AValue);
```

The following data types are allowed as metadata values:
Expand All @@ -167,35 +167,35 @@ The following data types are allowed as metadata values:
- std::string
- bool

`addMetaData` returns an integer value of zero upon success and returns -1
`addEntry` returns an integer value of zero upon success and returns -1
if the metadata name already exists.

To remove metadata from a MetaData instance, the `removeMetaData` function
To remove metadata from a MetaData instance, the `removeEntry` function
is used.

```
int ret;
ret = Data1->removeMetaData("NewMeta");
ret = Data1->removeEntry("NewMeta");
```

`removeMetaData` returns an integer value of zero upon success, -1 when there
`removeEntry` returns an integer value of zero upon success, -1 when there
is no metadata by that name, and -2 when the removal action fails for other
reasons.

## Retreive a Metadata from a MetaData Instance

Users can retrieve metadata using the `getMetaData` function.
Users can retrieve metadata using the `getEntry` function.

```
R8 R8Value;
ret = Data1->getMetaData("NewMeta", R8Value);
ret = Data1->getEntry("NewMeta", R8Value);
```

The first argument of `getMetaData` is the name of the metadata. The second
argument is passed by reference, allowing `getMetaData` to place
The first argument of `getEntry` is the name of the metadata. The second
argument is passed by reference, allowing `getEntry` to place
the metadata's value into it.

Note that `getMetaData` is overloaded with several methods, each having
Note that `getEntry` is overloaded with several methods, each having
different data types for the second argument. It is the user's responsibility
to match the metadata name with the correct data type of the value. Otherwise,
the function may throw a type-casting error exception.
Expand Down
12 changes: 6 additions & 6 deletions components/omega/doc/userGuide/MetaData.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,20 @@
```
### Managing Metadata in Instances
- **Adding Metadata**: Use `addMetaData` function.
- **Adding Metadata**: Use `addEntry` function.
```
const R8 AValue = 2.0;
int ret = Data1->addMetaData("NewMeta", AValue);
int ret = Data1->addEntry("NewMeta", AValue);
```
The following data types are allowed as metadata values: I4, I8, R4, R8, std::string, and bool.
- **Removing Metadata**: Employ `removeMetaData` function.
- **Removing Metadata**: Employ `removeEntry` function.
```
int ret = Data1->removeMetaData("NewMeta");
int ret = Data1->removeEntry("NewMeta");
```
- **Retrieving Metadata**: Use `getMetaData` function.
- **Retrieving Metadata**: Use `getEntry` function.
```
R8 R8Value;
int ret = Data1->getMetaData("NewMeta", R8Value);
int ret = Data1->getEntry("NewMeta", R8Value);
```
### Handling MetaData Instances
Expand Down
Loading

0 comments on commit c6c083f

Please sign in to comment.