{"id":22900569,"url":"https://github.com/cypri1-dev/42_cpp06","last_synced_at":"2025-04-01T05:14:42.045Z","repository":{"id":267479642,"uuid":"901377269","full_name":"cypri1-dev/42_CPP06","owner":"cypri1-dev","description":"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.","archived":false,"fork":false,"pushed_at":"2024-12-18T14:37:55.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T03:28:53.816Z","etag":null,"topics":["42cpp","42pr","cpp","cpp06"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cypri1-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-10T14:46:33.000Z","updated_at":"2024-12-18T14:38:41.000Z","dependencies_parsed_at":"2025-02-07T03:37:03.747Z","dependency_job_id":null,"html_url":"https://github.com/cypri1-dev/42_CPP06","commit_stats":null,"previous_names":["cypri1-dev/42_cpp06"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypri1-dev%2F42_CPP06","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypri1-dev%2F42_CPP06/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypri1-dev%2F42_CPP06/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypri1-dev%2F42_CPP06/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cypri1-dev","download_url":"https://codeload.github.com/cypri1-dev/42_CPP06/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246586036,"owners_count":20801028,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["42cpp","42pr","cpp","cpp06"],"created_at":"2024-12-14T01:28:50.483Z","updated_at":"2025-04-01T05:14:42.026Z","avatar_url":"https://github.com/cypri1-dev.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003e\u003cimg src=\"https://raw.githubusercontent.com/ayogun/42-project-badges/refs/heads/main/covers/cover-cpp-bonus.png\"\u003e\u003c/h1\u003e \n\n## Table of Contents  \n\n- [Overview](#overview)  \n- [Projects](#projects)  \n  - [Exercise 00: Conversion of Scalar Types](#exercise-00-conversion-of-scalar-types)  \n  - [Exercise 01: Serialization](#exercise-01-serialization)  \n  - [Exercise 02: Identify Real Type](#exercise-02-identify-real-type)  \n- [Requirements](#requirements)  \n- [Usage](#usage)  \n\n## Overview  \n\nThis module is designed to deepen understanding of C++ type conversion, serialization, and polymorphism through practical exercises.  \n\n## Projects  \n\n### Exercise 00: Conversion of Scalar Types  \n\n- **Goal**: Implement a `ScalarConverter` class with a single static method, `convert`, to convert a string literal into multiple scalar types (`char`, `int`, `float`, `double`).  \n- **Key Features**:  \n  - Handle pseudo-literals (`nan`, `+inf`, `-inf`, etc.).  \n  - Manage non-displayable and impossible conversions with clear error messages.  \n  - The class should not be instantiable.  \n\n### Exercise 01: Serialization  \n\n- **Goal**: Implement a `Serializer` class with the following methods:  \n  - `uintptr_t serialize(Data* ptr);`  \n  - `Data* deserialize(uintptr_t raw);`  \n- **Key Features**:  \n  - Convert a pointer to an unsigned integer type and back.  \n  - Ensure the deserialized pointer matches the original.  \n  - Create a non-empty `Data` structure to test serialization.  \n\n### Exercise 02: Identify Real Type  \n\n- **Goal**: Create a base class and derive three classes (`A`, `B`, `C`) with type identification functionality.  \n- **Key Features**:  \n  - Implement `Base* generate(void)` to randomly instantiate and return one of the derived types.  \n  - Use `void identify(Base* p)` and `void identify(Base\u0026 p)` to detect the actual type.  \n  - Avoid using `std::typeinfo`.  \n\n## Requirements  \n\n- **Language**: C++98  \n- **Compilation**:  \n  - A `Makefile` is provided for compilation.  \n  - Include the necessary headers for numeric limits and special values handling.  \n- **Environment**: Linux-based systems or any compatible environment supporting C++98.  \n\n## Usage  \n\n1. Clone the repository:  \n   ```bash\n   git clone \u003crepository-url\u003e\n   cd \u003crepository-folder\u003e\n   ```\n2. Build the project:\n   ```bash\n   make\n   ```\n3. Run the individual exercices:\n   ```bash\n   ./convert \u003cliteral\u003e\n   ./serialize\n   ./identify\n   ```\n4. Clean up:\n   ```bash\n   make fclean\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcypri1-dev%2F42_cpp06","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcypri1-dev%2F42_cpp06","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcypri1-dev%2F42_cpp06/lists"}