xref: /aosp_15_r20/external/openscreen/platform/README.md (revision 3f982cf4871df8771c9d4abe6e9a6f8d829b2736)
1*3f982cf4SFabien Sanglard# Platform API
2*3f982cf4SFabien Sanglard
3*3f982cf4SFabien SanglardThe Platform API is designed to allow easy porting of the Open Screen Library
4*3f982cf4SFabien Sanglardbetween platforms. This folder contains classes and logic used by Open Screen to
5*3f982cf4SFabien Sanglardaccess system resources and other common OS-level facilities, such as the clock
6*3f982cf4SFabien Sanglardand task runner. Note: utilities are generally not homed here, instead
7*3f982cf4SFabien Sanglardpreferring the top level util/ directory. New classes added here must NOT
8*3f982cf4SFabien Sanglarddepend on any other folders in the openscreen repository, excepting third party
9*3f982cf4SFabien Sanglardlibraries like Abseil or GTest. We include "default implementations" of many
10*3f982cf4SFabien Sanglardplatform features.
11*3f982cf4SFabien Sanglard
12*3f982cf4SFabien Sanglard## Directory structure
13*3f982cf4SFabien Sanglard
14*3f982cf4SFabien Sanglard - api/ contains the Platform API which is used by the Open Screen Library.
15*3f982cf4SFabien Sanglard   Some of the public API may also include adapter code that acts as a small
16*3f982cf4SFabien Sanglard   shim above the C functions to be implemented by the platform. The entire
17*3f982cf4SFabien Sanglard   Open Screen repository can depend on files from api/, though classes
18*3f982cf4SFabien Sanglard   defined in api/ can only depend on third_party or platform/base files.
19*3f982cf4SFabien Sanglard
20*3f982cf4SFabien Sanglard - base/ contains declarations/definitions of API constructs. Classes homed here
21*3f982cf4SFabien Sanglard   shall only depend on platform/api or this folder.
22*3f982cf4SFabien Sanglard
23*3f982cf4SFabien Sanglard - impl/ contains the implementation of the standalone use case, namely a
24*3f982cf4SFabien Sanglard   self-contained binary using the default implementation of the platform API.
25*3f982cf4SFabien Sanglard   Note: people familiar with the old layout may notice that all files from the
26*3f982cf4SFabien Sanglard   posix/, linux/, and mac/ directories have been moved here with an OS-specific
27*3f982cf4SFabien Sanglard   suffix (e.g. _mac, _posix).
28*3f982cf4SFabien Sanglard
29*3f982cf4SFabien Sanglard - test/ contains API implementations used for testing purposes, like the
30*3f982cf4SFabien Sanglard   FakeClock or FakeTaskRunner.
31