- Notifications
You must be signed in to change notification settings - Fork0
Develop a series of C++ utilities for type conversion, serialization, and runtime type identification. Implement ScalarConverter for literal conversion, Serializer for pointer serialization, and a Base hierarchy with dynamic type identification using polymorphism.
NotificationsYou must be signed in to change notification settings
cypri1-dev/42_CPP06
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This module is designed to deepen understanding of C++ type conversion, serialization, and polymorphism through practical exercises.
- Goal: Implement a
ScalarConverterclass with a single static method,convert, to convert a string literal into multiple scalar types (char,int,float,double). - Key Features:
- Handle pseudo-literals (
nan,+inf,-inf, etc.). - Manage non-displayable and impossible conversions with clear error messages.
- The class should not be instantiable.
- Handle pseudo-literals (
- Goal: Implement a
Serializerclass with the following methods:uintptr_t serialize(Data* ptr);Data* deserialize(uintptr_t raw);
- Key Features:
- Convert a pointer to an unsigned integer type and back.
- Ensure the deserialized pointer matches the original.
- Create a non-empty
Datastructure to test serialization.
- Goal: Create a base class and derive three classes (
A,B,C) with type identification functionality. - Key Features:
- Implement
Base* generate(void)to randomly instantiate and return one of the derived types. - Use
void identify(Base* p)andvoid identify(Base& p)to detect the actual type. - Avoid using
std::typeinfo.
- Implement
- Language: C++98
- Compilation:
- A
Makefileis provided for compilation. - Include the necessary headers for numeric limits and special values handling.
- A
- Environment: Linux-based systems or any compatible environment supporting C++98.
- Clone the repository:
git clone<repository-url>cd<repository-folder>
- Build the project:
make
- Run the individual exercices:
./convert<literal>./serialize./identify
- Clean up:
make fclean
About
Develop a series of C++ utilities for type conversion, serialization, and runtime type identification. Implement ScalarConverter for literal conversion, Serializer for pointer serialization, and a Base hierarchy with dynamic type identification using polymorphism.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
