Go to the documentation of this file.
36 #ifndef __BASE_EXTENSIBLE_HH__
37 #define __BASE_EXTENSIBLE_HH__
42 #include <type_traits>
59 virtual std::unique_ptr<ExtensionBase>
clone()
const = 0;
64 static unsigned int max_num = 0;
106 template <
typename Target,
typename T>
115 template <
typename Target,
typename T>
119 template <
typename Target>
140 template <
typename T>
144 static_assert(std::is_base_of<ExtensionBase, T>::value,
145 "Extension should inherit from ExtensionBase.");
146 assert(
ext.get() !=
nullptr);
148 auto it = findExtension<T>();
153 *it = std::move(
ext);
165 template <
typename T>
169 static_assert(std::is_base_of<ExtensionBase, T>::value,
170 "Extension should inherit from ExtensionBase.");
172 auto it = findExtension<T>();
180 template <
typename T>
184 static_assert(std::is_base_of<ExtensionBase, T>::value,
185 "Extension should inherit from ExtensionBase.");
186 auto it = findExtension<T>();
189 return std::static_pointer_cast<T>(*it);
201 template <
typename T>
207 if ((*it)->getExtensionID() == T::extensionID)
220 #endif //__BASE_EXTENSIBLE_HH__
std::list< std::shared_ptr< ExtensionBase > >::iterator findExtension()
Go through the extension list and return the iterator to the instance of the type of extension.
unsigned int getExtensionID() const
virtual std::unique_ptr< ExtensionBase > clone() const =0
virtual ~Extensible()=default
This is base of every extension.
ExtensionBase(const unsigned int id)
virtual ~ExtensionBase()=default
void setExtension(std::shared_ptr< T > ext)
Set a new extension to the packet and replace the old one, if there already exists the same type of e...
static unsigned int maxNumExtensions()
std::list< std::shared_ptr< ExtensionBase > > extensions
const static unsigned int extensionID
Extensible(const Extensible &other)
std::shared_ptr< T > getExtension()
Get the extension pointer by linear search with the extensionID.
void removeExtension(void)
Remove the extension based on its type.
This is the extension for carrying additional information.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Generated on Sun Jul 30 2023 01:56:51 for gem5 by doxygen 1.8.17