2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_NAMED_ENTITY_PAIR_TABLE_H_
18 #define incl_HPHP_NAMED_ENTITY_PAIR_TABLE_H_
20 #include "hphp/runtime/base/types.h"
21 #include "hphp/runtime/vm/containers.h"
22 #include "hphp/runtime/vm/named-entity.h"
24 #include "hphp/util/lock-free-ptr-wrapper.h"
25 #include "hphp/util/low-ptr.h"
30 * Vector of NamedEntityPairs, used as a map from Id to NEP.
32 struct NamedEntityPairTable
33 : VMCompactVector
<UnsafeLockFreePtrWrapper
<LowStringPtr
>> {
35 * Is `id' valid in this table?
37 bool contains(Id id
) const;
40 * Look up the litstr given by `id'.
42 * @requires: contains(id)
44 StringData
* lookupLitstr(Id id
) const;
47 * Look up the NamedEntity corresponding to the litstr given by `id'.
49 * @returns: lookupNamedEntityPair(id).second
51 const NamedEntity
* lookupNamedEntity(Id id
) const;
54 * Look up the NamedEntityPair corresponding to the litstr given by `id'.
56 * This will lazily populate the NamedEntity table, creating the NamedEntity
57 * for the litstr if it does not yet exist.
59 * @requires: contains(id)
61 NamedEntityPair
lookupNamedEntityPair(Id id
) const;
64 ///////////////////////////////////////////////////////////////////////////////
67 #define incl_HPHP_NAMED_ENTITY_PAIR_TABLE_INL_H_
68 #include "hphp/runtime/vm/named-entity-pair-table-inl.h"
69 #undef incl_HPHP_NAMED_ENTITY_PAIR_TABLE_INL_H_
71 #endif // incl_HPHP_NAMED_ENTITY_PAIR_TABLE_H_