Closed johndanenRV closed 4 months ago
Something like…
… in the header
Private:
Template
… in the cpp file:
Template<>
Const DeviceComponent next_
Template<>
Const DeviceComponent next_
….
Const catena::DeviceComponent next() { If (problem) throw exception; Return next(nextType); }
Read up on using enums as template parameters
John
From: johndanenRV @.> Date: Friday, May 24, 2024 at 2:51 PM To: rossvideo/Catena @.> Cc: John Naylor @.>, Review requested @.> Subject: [EXTERNAL] Re: [rossvideo/Catena] Device request scope (PR #170)
@johndanenRV commented on this pull request.
In sdks/cpp/common/src/DeviceModel.cpphttps://github.com/rossvideo/Catena/pull/170#discussion_r1613956323:
- languagePackIter_ = device.language_packs().packs().begin();
}
+void DeviceStream::attachClientScopes(std::vector
+}
+
+bool DeviceStream::hasNext(){
+}
+
+const catena::DeviceComponent& DeviceStream::next(){
if (clientScopes_ == nullptr){
throw std::runtime_error("Client scopes not attached");
}
switch(nextType_){
I'm not sure I understand how this would work. Don't the template arguments need to be known at compile time? How would nextType_ be used as a template argument?
— Reply to this email directly, view it on GitHubhttps://github.com/rossvideo/Catena/pull/170#discussion_r1613956323, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6R5EEKR4XF66HBZPCLMEVLZD6K4PAVCNFSM6AAAAABIH3B6OSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDANZXG44DOOBXGA. You are receiving this because your review was requested.Message ID: @.***>
This e-mail and any attachments may contain information that is confidential to Ross Video.
If you are not the intended recipient, please notify me immediately by replying to this message. Please also delete all copies. Thank you.
All of the sources I have looked at say that enum values can only be used as template arguments if they are known at compile time. If we want to use templates for next then it would have to be done like this:
const catena::DeviceComponent& DeviceStream::next(){
if (clientScopes_ == nullptr){
throw std::runtime_error("Client scopes not attached");
}
switch (nextType_){
case ComponentType::kBasicDeviceInfo:
return next_<ComponentType::kBasicDeviceInfo>(nextType_);
case ComponentType::kParam:
return next_<ComponentType::kParam>(nextType_);
case ComponentType::kConstraint:
return next_<ComponentType::kConstraint>(nextType_);
case ComponentType::kMenu:
return next_<ComponentType::kMenu>(nextType_);
case ComponentType::kCommand:
return next_<ComponentType::kCommand>(nextType_);
case ComponentType::kLanguagePack:
return next_<ComponentType::kLanguagePack>(nextType_);
case ComponentType::kFinished:
throw std::runtime_error("No more components to send");
}
}
Added deviceStream class for sending device components to clients. Also added a way to get params with unauthorized fields filtered out. Probably should have done this as two separate pull requests but it's too late to change that.