libsgfc++ 3.0.0
A C++ library that uses SGFC to read and write SGF (Smart Game Format) data.
Loading...
Searching...
No Matches
LibSgfcPlusPlus::SgfcBackendDataWrapper Class Reference

The SgfcBackendDataWrapper class is a wrapper around the SGFInfo data structure that is defined by the SGFC backend. SgfcBackendDataWrapper is responsible for managing the memory of an SGFInfo object. More...

#include <SgfcBackendDataWrapper.h>

Public Member Functions

 SgfcBackendDataWrapper ()
 Initializes a newly constructed SgfcBackendDataWrapper object that wraps an empty SGFInfo data structure. SGFC save operations that use the SGFInfo object will write data to a memory buffer. The data state is SgfcBackendDataState::NotLoaded.
 SgfcBackendDataWrapper (const std::string &sgfContent)
 Initializes a newly constructed SgfcBackendDataWrapper object that wraps an SGFInfo data structure that contains a file buffer with a duplicate of the content of sgfContent. SGFC save operations that use the SGFInfo object will write data to a memory buffer. The data state is SgfcBackendDataState::PartiallyLoaded.
virtual ~SgfcBackendDataWrapper ()
 Destroys and cleans up the SgfcBackendDataWrapper object.
SGFInfo * GetSgfData () const
 Returns a pointer to the SGFInfo data object that the SgfcBackendDataWrapper encapsulates.

Friends

class SgfcBackendController

Detailed Description

The SgfcBackendDataWrapper class is a wrapper around the SGFInfo data structure that is defined by the SGFC backend. SgfcBackendDataWrapper is responsible for managing the memory of an SGFInfo object.

When SgfcBackendDataWrapper is constructed it immediately allocates the memory for a basic empty SGFInfo object that does not contain any data yet.

While SgfcBackendDataWrapper lives, clients can access the SGFInfo object for the following purposes:

  • Only once: Pass the SGFInfo object to the SGFC backend for a load operation. The SGFC backend will populate the SGFInfo object with further data structures that contain the SGF data it loaded. SgfcBackendDataWrapper becomes responsible for deallocating these further data structures.
  • Any amount of times: Parse the SGFInfo object after it was populated by an SGFC backend load operation.
  • Only once: Populate the empty SGFInfo object with data structures that contain the SGF data to be passed to SGFC for writing. SgfcBackendDataWrapper becomes responsible for deallocating the data structures.
  • Only once: Pass the SGFInfo object to the SGFC backend for a save operation. The SGFC backend will modify some of the data in the SGFInfo object, so parsing the object before and after a save operation will yield different results.

When SgfcBackendDataWrapper is destroyed, it deallocates all memory that is currently occupied by the SGFInfo object. It doesn't matter whether an SGFC backend load and/or save operation have been performed since construction.


The documentation for this class was generated from the following files:
  • /Users/dev/Documents/libsgfcplusplus/src/sgfc/backend/SgfcBackendDataWrapper.h
  • /Users/dev/Documents/libsgfcplusplus/src/sgfc/backend/SgfcBackendDataWrapper.cpp