chromium/third_party/cld_3/src/src/workspace.h

/* Copyright 2016 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

// Notes on thread-safety: All of the classes here are thread-compatible.  More
// specifically, the registry machinery is thread-safe, as long as each thread
// performs feature extraction on a different Sentence object.

#ifndef WORKSPACE_H_
#define WORKSPACE_H_

#include <stddef.h>
#include <string>
#include <typeindex>
#include <unordered_map>
#include <utility>
#include <vector>

#include "base.h"

namespace chrome_lang_id {

// A base class for shared workspaces. Derived classes implement a static member
// function TypeName() which returns a human readable string name for the class.
class Workspace {};

// A registry that keeps track of workspaces.
class WorkspaceRegistry {};

// A typed collected of workspaces. The workspaces are indexed according to an
// external WorkspaceRegistry. If the WorkspaceSet is const, the contents are
// also immutable.
class WorkspaceSet {};

// A workspace that wraps around a single int.
class SingletonIntWorkspace : public Workspace {};

// A workspace that wraps around a vector of int.
class VectorIntWorkspace : public Workspace {};

// A workspace that wraps around a vector of vector of int.
class VectorVectorIntWorkspace : public Workspace {};

}  // namespace chrome_lang_id

#endif  // WORKSPACE_H_