chromium/third_party/spirv-tools/src/source/util/ilist.h

// Copyright (c) 2017 Google Inc.
//
// 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.

#ifndef SOURCE_UTIL_ILIST_H_
#define SOURCE_UTIL_ILIST_H_

#include <cassert>
#include <memory>
#include <type_traits>
#include <vector>

#include "source/util/ilist_node.h"

namespace spvtools {
namespace utils {

// An IntrusiveList is a generic implementation of a doubly-linked list.  The
// intended convention for using this container is:
//
//      class Node : public IntrusiveNodeBase<Node> {
//        // Note that "Node", the class being defined is the template.
//        // Must have a default constructor accessible to List.
//        // Add whatever data is needed in the node
//      };
//
//      using List = IntrusiveList<Node>;
//
// You can also inherit from IntrusiveList instead of a typedef if you want to
// add more functionality.
//
// The condition on the template for IntrusiveNodeBase is there to add some type
// checking to the container.  The compiler will still allow inserting elements
// of type IntrusiveNodeBase<Node>, but that would be an error. This assumption
// allows NextNode and PreviousNode to return pointers to Node, and casting will
// not be required by the user.

template <class NodeType>
class IntrusiveList {};

// Implementation of IntrusiveList

template <class NodeType>
inline IntrusiveList<NodeType>::IntrusiveList() :{}

template <class NodeType>
IntrusiveList<NodeType>::IntrusiveList(IntrusiveList&& list) :{}

template <class NodeType>
IntrusiveList<NodeType>::~IntrusiveList() {}

template <class NodeType>
IntrusiveList<NodeType>& IntrusiveList<NodeType>::operator=(
    IntrusiveList<NodeType>&& list) {}

template <class NodeType>
inline typename IntrusiveList<NodeType>::iterator
IntrusiveList<NodeType>::begin() {}

template <class NodeType>
inline typename IntrusiveList<NodeType>::iterator
IntrusiveList<NodeType>::end() {}

template <class NodeType>
inline typename IntrusiveList<NodeType>::const_iterator
IntrusiveList<NodeType>::begin() const {}

template <class NodeType>
inline typename IntrusiveList<NodeType>::const_iterator
IntrusiveList<NodeType>::end() const {}

template <class NodeType>
inline typename IntrusiveList<NodeType>::const_iterator
IntrusiveList<NodeType>::cbegin() const {}

template <class NodeType>
inline typename IntrusiveList<NodeType>::const_iterator
IntrusiveList<NodeType>::cend() const {}

template <class NodeType>
void IntrusiveList<NodeType>::push_back(NodeType* node) {}

template <class NodeType>
bool IntrusiveList<NodeType>::empty() const {}

template <class NodeType>
void IntrusiveList<NodeType>::clear() {}

template <class NodeType>
NodeType& IntrusiveList<NodeType>::front() {}

template <class NodeType>
NodeType& IntrusiveList<NodeType>::back() {}

template <class NodeType>
const NodeType& IntrusiveList<NodeType>::front() const {}

template <class NodeType>
const NodeType& IntrusiveList<NodeType>::back() const {}

template <class NodeType>
void IntrusiveList<NodeType>::Splice(iterator where,
                                     IntrusiveList<NodeType>* other,
                                     iterator first, iterator last) {}

template <class NodeType>
void IntrusiveList<NodeType>::Check(NodeType* start) {}

}  // namespace utils
}  // namespace spvtools

#endif  // SOURCE_UTIL_ILIST_H_