# Level

This class is nested in the levels class and contain a single level

```cpp
class Level {
public:
    class EntityEvents
    {
    private:
        std::vector<std::pair<size_t, std::vector<size_t>>> _spawns;
        unsigned char _entity;
        std::vector<std::pair<size_t, std::vector<size_t>>>::iterator _it;
        bool _init = true;
    public:
        EntityEvents(unsigned char entity);
        ~EntityEvents();
        std::vector<size_t> getSpawns(size_t currentTimecode);
        void addSpawn(size_t timecode, size_t pos);
        unsigned char getEntity() const;
        void sort();
        bool isFinished() const;
        void setInit(bool init);
    };

    class StrobeEvent
    {
    private:
        std::vector<std::tuple<size_t, unsigned char, bool>> _strobe;
        std::vector<std::tuple<size_t, unsigned char, bool>>::iterator _it;
        bool _init = true;
    public:
        StrobeEvent();
        ~StrobeEvent();
        std::vector<std::tuple<size_t, unsigned char, bool>> getEvents(size_t currentTimecode);
        void addColor(size_t timecode, unsigned char color, size_t duration);
        void sort();
        bool isFinished() const;
        void setInit(bool init);
    };

    Level(const std::string &path);
    ~Level();
    std::vector<EntityEvents> &getEvents();
    StrobeEvent &getStrobes();
    unsigned char getSong() const;
    bool isEnded() const;
private:
    void parsSong(const std::string &line, const std::string &path, size_t line_nb);
    void parsEvents(const std::string &line, const std::string &path, size_t line_nb);
    std::vector<EntityEvents> _events;
    StrobeEvent _strobes;
    unsigned char _song = 0;
    char _parserEntity = -1;
};
```

### Construcor

parameters

* A string that contain the file path of the level script

```cpp
Level(const std::string &path);
```

### Get

The Getter function are used to get the differents events of the level like spawn entities or spawn strobes

```cpp
std::vector<EntityEvents> &getEvents();
StrobeEvent &getStrobes();
unsigned char getSong() const;
```

### isEnded

This function check if the level is finished

```cpp
bool isEnded() const;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://redboard.gitbook.io/r-type-1/server/levels/level.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
