summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/shared/struct/map/shr_map_marker.erl')
-rw-r--r-- | src/shared/struct/map/shr_map_marker.erl | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/shared/struct/map/shr_map_marker.erl b/src/shared/struct/map/shr_map_marker.erl new file mode 100644 index 0000000..35ba195 --- /dev/null +++ b/src/shared/struct/map/shr_map_marker.erl @@ -0,0 +1,52 @@ +-module(shr_map_marker). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-type name() :: binary(). +-type type() :: 'none'. +-type collection() :: orddict:orddict(name(), type()). + +-export_type([name/0, type/0, collection/0]). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-export +( + [ + get/2, + empty_collection/0 + ] +). + +-export +( + [ + decode_collection/1, + encode_collection/1 + ] +). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-spec get (name(), collection()) -> ('not_found' | {'ok', type()}). +get (Name, Collection) -> + case orddict:find(Name, Collection) of + error -> not_found; + Other -> Other + end. + +-spec empty_collection () -> collection(). +empty_collection () -> orddict:new(). + +-spec encode_collection (collection()) -> list(any()). +encode_collection (_Collection) -> []. + +-spec decode_collection (map()) -> collection(). +decode_collection (_Map) -> orddict:new(). |