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

Add interface for accessing CustomReq/Resp data #1021

Merged
merged 4 commits into from
Jan 8, 2024
Merged
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
86 changes: 85 additions & 1 deletion src/sst/core/interfaces/stdMem.h
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,48 @@ class StandardMem : public SubComponent
return str.str();
}

/**
* Get the CustomData object associated with this request.
* Ownership of the CustomData object is retained by this request.
*/
CustomData& getData() { return *data; }

/**
* Get the CustomData object associated with this request.
* Ownership of the CustomData object is retained by this request.
* The returned data cannot be modified.
*/
const CustomData& getData() const { return *data; }

/**
* Set the CustomData object associated with this request to a new
* value.
* This request takes ownership of the CustomData object.
* The previous CustomData object is deleted.
*/
void setData(CustomData* d)
{
delete data;
data = d;
}

/**
* Reset the CustomData object associated with this request to a new
* value.
* The previous CustomData object is returned and ownership is
* transferred to the caller.
* This request assumes ownership of the passed in CustomData object.
* If no CustomData object is passed in, the data member is set to nullptr.
*/
CustomData* resetData(CustomData* d = nullptr) { return std::exchange(data, d); }

/**
* Obtain the CustomData object associated with this request.
* Ownership of the CustomData object is transferred to the caller.
* The data member of this request is set to nullptr.
*/
CustomData* releaseData() { return resetData(); }

CustomData* data; /* Custom class that holds data for this event */
Addr iPtr; /* Instruction pointer */
uint32_t tid; /* Thread ID */
Expand All @@ -930,7 +972,7 @@ class StandardMem : public SubComponent
{}
CustomResp(CustomReq* req) :
Request(req->getID(), req->getAllFlags()),
data(req->data->makeResponse()),
data(req->getData().makeResponse()),
iPtr(req->iPtr),
tid(req->tid)
{}
Expand All @@ -952,6 +994,48 @@ class StandardMem : public SubComponent
return str.str();
}

/**
* Get the CustomData object associated with this response.
* Ownership of the CustomData object is retained by this response.
*/
CustomData& getData() { return *data; }

/**
* Get the CustomData object associated with this response.
* Ownership of the CustomData object is retained by this response.
* The returned data cannot be modified.
*/
const CustomData& getData() const { return *data; }

/**
* Set the CustomData object associated with this response to a new
* value.
* This response takes ownership of the CustomData object.
* The previous CustomData object is deleted.
*/
void setData(CustomData* d)
{
delete data;
data = d;
}

/**
* Reset the CustomData object associated with this response to a new
* value.
* The previous CustomData object is returned and ownership is
* transferred to the caller.
* This response assumes ownership of the passed in CustomData object.
* If no CustomData object is passed in, the data member is set to nullptr.
*/
CustomData* resetData(CustomData* d = nullptr) { return std::exchange(data, d); }

/**
* Obtain the CustomData object associated with this response.
* Ownership of the CustomData object is transferred to the caller.
* The data member of this response is set to nullptr.
*/
CustomData* releaseData() { return resetData(); }

CustomData* data; /* Custom class that holds data for this event */
Addr iPtr; /* Instruction pointer */
uint32_t tid; /* Thread ID */
Expand Down
Loading