Skip to content

raisim::server::SceneFileServer ​

class · #include <raisim/server/SceneFileServer.hpp>

Internal: serves the files of a RaiSim Engine scene to a viewer.

Nested classes ​

  • struct Entry — One file of the manifest.
  • struct Request — A decoded CR_SCENE_MANIFEST (chunk = false) or CR_SCENE_FILE_CHUNK request.

Public member functions ​

setEnabled ​

cpp
void setEnabled(bool enabled)

Parameters

ParameterDescription
enabled (in)false makes every response report scene_files::kDisabled

enabled ​

cpp
bool enabled() const

Returns whether files are shared

invalidate ​

cpp
void invalidate()

Re-list and re-check the files before the next manifest, e.g. for a new client, so a file edited while the server runs is hashed again. Unchanged files keep their hash.

prepare ​

cpp
void prepare(const rscene::Scene *scene, std::size_t byteBudget)

Advance the file list of the scene: list the files once, then hash at most byteBudget bytes. Call once per frame, outside the world lock.

Parameters

ParameterDescription
scene (in)the world's scene, or nullptr
byteBudget (in)most bytes to read and hash in this call

status ​

cpp
scene_files::Status status() const

Returns the state reported in the response header

manifestId ​

cpp
std::uint64_t manifestId() const

Returns the manifest id (0 unless ready)

entries ​

cpp
const std::vector<Entry> &entries() const

Returns the listed files (complete once ready)

stage ​

cpp
void stage(
    const std::vector<Request> &requests,
    std::size_t chunkBudget,
    std::size_t manifestBudget=0)

Stage the answers to this frame's requests, reading chunk data now so the world lock is not held during file I/O. Chunks beyond chunkBudget bytes are shortened or left out; the viewer asks again for what it did not receive. The manifest is sent once per frame within manifestBudget. Its bytes reduce the remaining chunk budget.

Parameters

ParameterDescription
requests (in)decoded requests in arrival order
chunkBudget (in)most chunk bytes to send in this frame
manifestBudget (in)most manifest bytes to send; zero uses chunkBudget

write ​

cpp
BoundedWriter write(BoundedWriter data) const

Write the scene-file block of the response header (format in SceneFileProtocol.hpp).

Parameters

ParameterDescription
data (in)write position

Returns the position after the block

RaiSim — physics for robotics and AI.