1 : // Copyright 2012 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : //
15 : // Internal implementation details for msf_file.h. Not meant to be included
16 : // directly.
17 :
18 : #ifndef SYZYGY_MSF_MSF_FILE_IMPL_H_
19 : #define SYZYGY_MSF_MSF_FILE_IMPL_H_
20 :
21 : #include "base/logging.h"
22 : #include "base/memory/ref_counted.h"
23 : #include "syzygy/msf/msf_decl.h"
24 :
25 : namespace msf {
26 : namespace detail {
27 :
28 : template <MsfFileType T>
29 E : MsfFileImpl<T>::MsfFileImpl() {
30 E : }
31 :
32 : template <MsfFileType T>
33 E : MsfFileImpl<T>::~MsfFileImpl() {
34 E : Clear();
35 E : }
36 :
37 : template <MsfFileType T>
38 E : void MsfFileImpl<T>::Clear() {
39 E : streams_.clear();
40 E : }
41 :
42 : template <MsfFileType T>
43 E : scoped_refptr<MsfStreamImpl<T>> MsfFileImpl<T>::GetStream(uint32 index) const {
44 E : DCHECK_LT(index, streams_.size());
45 E : return streams_[index];
46 E : }
47 :
48 : template <MsfFileType T>
49 E : size_t MsfFileImpl<T>::AppendStream(MsfStreamImpl<T>* msf_stream) {
50 E : size_t index = streams_.size();
51 E : streams_.push_back(msf_stream);
52 E : return index;
53 E : }
54 :
55 : template <MsfFileType T>
56 E : void MsfFileImpl<T>::ReplaceStream(uint32 index, MsfStreamImpl<T>* msf_stream) {
57 E : DCHECK_LT(index, streams_.size());
58 E : streams_[index] = msf_stream;
59 E : }
60 :
61 : template <MsfFileType T>
62 E : void MsfFileImpl<T>::SetStream(uint32 index, MsfStreamImpl<T>* msf_stream) {
63 E : if (index >= streams_.size())
64 E : streams_.resize(index + 1);
65 :
66 E : streams_[index] = msf_stream;
67 E : }
68 :
69 : } // namespace detail
70 : } // namespace msf
71 :
72 : #endif // SYZYGY_MSF_MSF_FILE_IMPL_H_
|