text:
using System;

namespace Mozu.Api.Contracts.SiteSettings.Order
{
		///
		///	The details of the payment terms assocaited with the purchase order payment.Refer to [Payment Terms](https://www.mozu.com/docs/guides/orders/purchase-order.htm#payment_terms) in the Purchase Orders guides topic for more information.
		///
		public class PurchaseOrderPaymentTerm
		{
			///
			///The unique code for the payment term associated with the purchase order payment type.Refer to [Payment Terms](https://www.mozu.com/docs/guides/orders/purchase-order.htm#payment_terms) in the Purchase Orders guides topic for more information.
			///
			public string Code { get; set; }

			///
			///The localized description in text for the object, displayed per the locale code. For example, descriptions are used for product descriptions, attributes, and pre-authorization transaction types.
			///
			public string Description { get; set; }

			///
			///The order/sequence position in which  displays the payment term.
			///
			public int SequenceNumber { get; set; }

		}

}


text:
#pragma once
#include <aws/connect/Connect_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/connect/model/UseCaseType.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace Connect
{
namespace Model
{

  /**
   *
Contains the use case.

See Also:
   AWS API
   * Reference

   */
  class AWS_CONNECT_API UseCase
  {
  public:
    UseCase();
    UseCase(Aws::Utils::Json::JsonView jsonValue);
    UseCase& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
The identifier for the use case.

     */
    inline const Aws::String& GetUseCaseId() const{ return m_useCaseId; }

    /**
     *
The identifier for the use case.

     */
    inline bool UseCaseIdHasBeenSet() const { return m_useCaseIdHasBeenSet; }

    /**
     *
The identifier for the use case.

     */
    inline void SetUseCaseId(const Aws::String& value) { m_useCaseIdHasBeenSet = true; m_useCaseId = value; }

    /**
     *
The identifier for the use case.

     */
    inline void SetUseCaseId(Aws::String&& value) { m_useCaseIdHasBeenSet = true; m_useCaseId = std::move(value); }

    /**
     *
The identifier for the use case.

     */
    inline void SetUseCaseId(const char* value) { m_useCaseIdHasBeenSet = true; m_useCaseId.assign(value); }

    /**
     *
The identifier for the use case.

     */
    inline UseCase& WithUseCaseId(const Aws::String& value) { SetUseCaseId(value); return *this;}

    /**
     *
The identifier for the use case.

     */
    inline UseCase& WithUseCaseId(Aws::String&& value) { SetUseCaseId(std::move(value)); return *this;}

    /**
     *
The identifier for the use case.

     */
    inline UseCase& WithUseCaseId(const char* value) { SetUseCaseId(value); return *this;}

    /**
     *
The Amazon Resource Name (ARN) for the use case.

     */
    inline const Aws::String& GetUseCaseArn() const{ return m_useCaseArn; }

    /**
     *
The Amazon Resource Name (ARN) for the use case.

     */
    inline bool UseCaseArnHasBeenSet() const { return m_useCaseArnHasBeenSet; }

    /**
     *
The Amazon Resource Name (ARN) for the use case.

     */
    inline void SetUseCaseArn(const Aws::String& value) { m_useCaseArnHasBeenSet = true; m_useCaseArn = value; }

    /**
     *
The Amazon Resource Name (ARN) for the use case.

     */
    inline void SetUseCaseArn(Aws::String&& value) { m_useCaseArnHasBeenSet = true; m_useCaseArn = std::move(value); }

    /**
     *
The Amazon Resource Name (ARN) for the use case.

     */
    inline void SetUseCaseArn(const char* value) { m_useCaseArnHasBeenSet = true; m_useCaseArn.assign(value); }

    /**
     *
The Amazon Resource Name (ARN) for the use case.

     */
    inline UseCase& WithUseCaseArn(const Aws::String& value) { SetUseCaseArn(value); return *this;}

    /**
     *
The Amazon Resource Name (ARN) for the use case.

     */
    inline UseCase& WithUseCaseArn(Aws::String&& value) { SetUseCaseArn(std::move(value)); return *this;}

    /**
     *
The Amazon Resource Name (ARN) for the use case.

     */
    inline UseCase& WithUseCaseArn(const char* value) { SetUseCaseArn(value); return *this;}

    /**
     *
The type of use case to associate to the integration association. Each
     * integration association can have only one of each use case type.

     */
    inline const UseCaseType& GetUseCaseType() const{ return m_useCaseType; }

    /**
     *
The type of use case to associate to the integration association. Each
     * integration association can have only one of each use case type.

     */
    inline bool UseCaseTypeHasBeenSet() const { return m_useCaseTypeHasBeenSet; }

    /**
     *
The type of use case to associate to the integration association. Each
     * integration association can have only one of each use case type.

     */
    inline void SetUseCaseType(const UseCaseType& value) { m_useCaseTypeHasBeenSet = true; m_useCaseType = value; }

    /**
     *
The type of use case to associate to the integration association. Each
     * integration association can have only one of each use case type.

     */
    inline void SetUseCaseType(UseCaseType&& value) { m_useCaseTypeHasBeenSet = true; m_useCaseType = std::move(value); }

    /**
     *
The type of use case to associate to the integration association. Each
     * integration association can have only one of each use case type.

     */
    inline UseCase& WithUseCaseType(const UseCaseType& value) { SetUseCaseType(value); return *this;}

    /**
     *
The type of use case to associate to the integration association. Each
     * integration association can have only one of each use case type.

     */
    inline UseCase& WithUseCaseType(UseCaseType&& value) { SetUseCaseType(std::move(value)); return *this;}

  private:

    Aws::String m_useCaseId;
    bool m_useCaseIdHasBeenSet;

    Aws::String m_useCaseArn;
    bool m_useCaseArnHasBeenSet;

    UseCaseType m_useCaseType;
    bool m_useCaseTypeHasBeenSet;
  };

} // namespace Model
} // namespace Connect
} // namespace Aws

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Linq;
using MongoDB.Bson.IO;

namespace MongoDB.Bson.Serialization.Serializers
{
    /// <summary>
    /// Represents a helper for serializers.
    /// </summary>
    public class SerializerHelper
    {
        // private fields
        private readonly long _allMemberFlags;
        private readonly long _extraMemberFlag;
        private readonly Member[] _members;
        private readonly long _requiredMemberFlags;
        private readonly BsonTrie<long> _trie;

        // constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="SerializerHelper"/> class.
        /// </summary>
        /// <param name="members">The members.</param>
        public SerializerHelper(params Member[] members)
        {
            if (members == null)
            {
                throw new ArgumentNullException("members");
            }
            if (members.Length > 64)
            {
                throw new ArgumentException("SerializerHelper supports a maximum of 64 members.", "members");
            }

            _members = members;
            _trie = new BsonTrie<long>();

            foreach (var member in members)
            {
                _allMemberFlags |= member.Flag;
                if (!member.IsOptional)
                {
                    _requiredMemberFlags |= member.Flag;
                }

                if (member.ElementName == "*")
                {
                    _extraMemberFlag = member.Flag;
                }
                else
                {
                    _trie.Add(member.ElementName, member.Flag);
                }
            }
        }

        // public methods
        /// <summary>
        /// Deserializes the members.
        /// </summary>
        /// <param name="context">The deserialization context.</param>
        /// <param name="memberHandler">The member handler.</param>
        /// <returns>The found member flags.</returns>
        public long DeserializeMembers(BsonDeserializationContext context, Action<string, long> memberHandler)
        {
            var reader = context.Reader;
            var foundMemberFlags = 0L;

            reader.ReadStartDocument();
            while (reader.ReadBsonType() != 0)
            {
                bool found;
                long memberFlag;
                var elementName = reader.ReadName(_trie, out found, out memberFlag);

                if (!found)
                {
                    if (_extraMemberFlag == 0)
                    {
                        throw new BsonSerializationException(string.Format(
                            "Invalid element: '{0}'.", elementName));
                    }
                    else
                    {
                        memberFlag = _extraMemberFlag;
                    }
                }

                memberHandler(elementName, memberFlag);
                foundMemberFlags |= memberFlag;
            }
            reader.ReadEndDocument();

            var missingRequiredMemberFlags = _requiredMemberFlags & ~foundMemberFlags;
            if (missingRequiredMemberFlags != 0)
            {
                var missingRequiredMember = FindFirstMissingRequiredMember(missingRequiredMemberFlags);
                throw new BsonSerializationException(string.Format(
                   "Missing element: '{0}'.", missingRequiredMember.ElementName));
            }

            return foundMemberFlags;
        }

        // private methods
        private Member FindFirstMissingRequiredMember(long missingRequiredMemberFlags)
        {
            foreach (var member in _members)
            {
                if ((member.Flag & missingRequiredMemberFlags) != 0)
                {
                    return member;
                }
            }
            throw new BsonInternalException();
        }

        // nested types
        /// <summary>
        /// Represents information about a member.
        /// </summary>
        public class Member
        {
            // private static fields
            private static readonly long[] __validFlags = Enumerable.Range(0, 64).Select(i => 1L << i).ToArray();

            // private fields
            private readonly string _elementName;
            private readonly long _flag;
            private readonly bool _isOptional;

            // constuctors
            /// <summary>
            /// Initializes a new instance of the <see cref="Member" /> class.
            /// </summary>
            /// <param name="elementName">The name of the element.</param>
            /// <param name="flag">The flag.</param>
            /// <param name="isOptional">Whether the member is optional.</param>
            public Member(
                string elementName,
                long flag,
                bool isOptional = false)
            {
                if (string.IsNullOrEmpty(elementName))
                {
                    throw new ArgumentException(string.Format("Invalid element name: '{0}'.", elementName));
                }
                if (!__validFlags.Contains(flag))
                {
                    throw new ArgumentException(string.Format("Invalid member flag: {0:x}.", flag));
                }

                _elementName = elementName;
                _flag = flag;
                _isOptional = isOptional;
            }

            // public properties
            /// <summary>
            /// Gets the flag.
            /// </summary>
            /// <value>
            /// The flag.
            /// </value>
            public long Flag
            {
                get { return _flag; }
            }

            /// <summary>
            /// Gets the name of the element.
            /// </summary>
            /// <value>
            /// The name of the element.
            /// </value>
            public string ElementName
            {
                get { return _elementName; }
            }

            /// <summary>
            /// Gets a value indicating whether this member is optional.
            /// </summary>
            /// <value>Whether this member is optional.</value>
            public bool IsOptional
            {
                get { return _isOptional; }
            }
        }
    }
}


text:
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/import/chips/p9/procedures/hwp/memory/lib/dimm/rank.H $   */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2015,2017                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* 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.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */

///
/// @file rank.H
/// @brief Do things with or for ranks
///
// *HWP HWP Owner: Jacob Harvey <jlharvey@us.ibm.com>
// *HWP HWP Backup: Andre Marin <aamarin@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 3
// *HWP Consumed by: HB:FSP

#ifndef _MSS_RANK_H_
#define _MSS_RANK_H_

#include <fapi2.H>
#include <lib/mss_attribute_accessors.H>
#include <p9_mc_scom_addresses.H>
#include <p9_mc_scom_addresses_fld.H>
#include <generic/memory/lib/utils/scom.H>
#include <lib/utils/num.H>
#include <lib/utils/count_dimm.H>
#include <lib/shared/mss_const.H>
#include <lib/phy/phy_cntrl.H>

namespace mss
{

enum
{
    PRIMARY = 0,
    SECONDARY = 1,
    TERTIARY = 2,
    QUATERNARY = 3,
    NO_RANK = 999,

    // These enums represent the rank fields and valid bits from rank_pair_assignments
    EVEN_PRIMARY_RANK = 48,
    EVEN_SECONDARY_RANK = 52,
    ODD_PRIMARY_RANK = 56,
    ODD_SECONDARY_RANK = 60,
    RANK_LEN = 3,
    EVEN_PRIMARY_VALID = 51,
    EVEN_SECONDARY_VALID = 55,
    ODD_PRIMARY_VALID = 59,
    ODD_SECONDARY_VALID = 63,

};

///
/// @class rankPairTraits
/// @brief a collection of traits associated with rank pairs
/// @tparam T fapi2::TargetType representing the PHY
/// @tparam RP the rank pair
///
template< fapi2::TargetType T, uint64_t RP >
class rankPairTraits;

///
/// @class rankPairTraits
/// @brief a collection of traits associated with the Centaur PHY
///
template< uint64_t RP >
class rankPairTraits< fapi2::TARGET_TYPE_MBA, RP >
{
};

///
/// @class rankPairTraits
/// @brief a collection of traits associated with the Nimbus PHY rank pair 0
///
// TODO RTC:160869 Clean up rank utility functions, edd enums where appropriate
template<>
class rankPairTraits< fapi2::TARGET_TYPE_MCA, 0 >
{
    public:
        enum
        {
            NUM_RANK_PAIR_REGS = 2,
            NUM_RANKS_IN_PAIR = 4,
        };

        // MCA rank config registers
        constexpr static uint64_t RANK_GROUP = MCA_DDRPHY_PC_RANK_GROUP_P0;
        constexpr static uint64_t RANK_GROUP_EXT = MCA_DDRPHY_PC_RANK_GROUP_EXT_P0;
        static const std::vector< uint64_t > RANK_PAIR_REGS;

        // Mapping for which fields below (primary, secondary, ...) go into which regs
        static const std::vector< uint64_t > RANK_PAIR_FIELD_MAP;

        // MCA rank and valid fields.
        constexpr static const uint64_t RANK_PAIR_FIELDS[] =
        {
            MCA_DDRPHY_PC_RANK_PAIR0_P0_PRI,
            MCA_DDRPHY_PC_RANK_PAIR0_P0_SEC,
            MCA_DDRPHY_PC_RANK_PAIR2_P0_PAIR0_TER,
            MCA_DDRPHY_PC_RANK_PAIR2_P0_PAIR0_QUA,
        };
        constexpr static const uint64_t RANK_PAIR_LENGTHS[] =
        {
            MCA_DDRPHY_PC_RANK_PAIR0_P0_PRI_LEN,
            MCA_DDRPHY_PC_RANK_PAIR0_P0_SEC_LEN,
            MCA_DDRPHY_PC_RANK_PAIR2_P0_PAIR0_TER_LEN,
            MCA_DDRPHY_PC_RANK_PAIR2_P0_PAIR0_QUA_LEN,
        };
        constexpr static const uint64_t RANK_PAIR_VALIDS[] =
        {
            MCA_DDRPHY_PC_RANK_PAIR0_P0_PRI_V,
            MCA_DDRPHY_PC_RANK_PAIR0_P0_SEC_V,
            MCA_DDRPHY_PC_RANK_PAIR2_P0_PAIR0_TER_V,
            MCA_DDRPHY_PC_RANK_PAIR2_P0_PAIR0_QUA_V,
        };

        // PHY RANK_GROUP register ADDR_MIRROR fields, indexed by rank ordinal
        constexpr static const uint64_t ADDR_MIRROR[] =
        {
            MCA_DDRPHY_PC_RANK_GROUP_P0_ADDR_MIRROR_RP0_PRI,
            MCA_DDRPHY_PC_RANK_GROUP_P0_ADDR_MIRROR_RP0_SEC,
            MCA_DDRPHY_PC_RANK_GROUP_EXT_P0_ADDR_MIRROR_RP0_TER,
            MCA_DDRPHY_PC_RANK_GROUP_EXT_P0_ADDR_MIRROR_RP0_QUA,
        };
};

///
/// @class rankPairTraits
/// @brief a collection of traits associated with the Nimbus PHY rank pair 1
///
template<>
class rankPairTraits< fapi2::TARGET_TYPE_MCA, 1 >
{
    public:
        enum
        {
            NUM_RANK_PAIR_REGS = 2,
            NUM_RANKS_IN_PAIR = 4,
        };

        // MCA rank config registers
        static const std::vector< uint64_t > RANK_PAIR_REGS;

        // Mapping for which fields below (primary, secondary, ...) go into which regs
        static const std::vector< uint64_t > RANK_PAIR_FIELD_MAP;

        // MCA rank and valid fields.
        constexpr static const uint64_t RANK_PAIR_FIELDS[] =
        {
            MCA_DDRPHY_PC_RANK_PAIR0_P0_PAIR1_PRI,
            MCA_DDRPHY_PC_RANK_PAIR0_P0_PAIR1_SEC,
            MCA_DDRPHY_PC_RANK_PAIR2_P0_PAIR1_TER,
            MCA_DDRPHY_PC_RANK_PAIR2_P0_PAIR1_QUA,
        };
        constexpr static const uint64_t RANK_PAIR_LENGTHS[] =
        {
            MCA_DDRPHY_PC_RANK_PAIR0_P0_PAIR1_PRI_LEN,
            MCA_DDRPHY_PC_RANK_PAIR0_P0_PAIR1_SEC_LEN,
            MCA_DDRPHY_PC_RANK_PAIR2_P0_PAIR1_TER_LEN,
            MCA_DDRPHY_PC_RANK_PAIR2_P0_PAIR1_QUA_LEN,
        };
        constexpr static const uint64_t RANK_PAIR_VALIDS[] =
        {
            MCA_DDRPHY_PC_RANK_PAIR0_P0_PAIR1_PRI_V,
            MCA_DDRPHY_PC_RANK_PAIR0_P0_PAIR1_SEC_V,
            MCA_DDRPHY_PC_RANK_PAIR2_P0_PAIR1_TER_V,
            MCA_DDRPHY_PC_RANK_PAIR2_P0_PAIR1_QUA_V,
        };
        // PHY RANK_GROUP register ADDR_MIRROR fields, indexed by rank ordinal
        constexpr static const uint64_t ADDR_MIRROR[] =
        {
            MCA_DDRPHY_PC_RANK_GROUP_P0_ADDR_MIRROR_RP1_PRI,
            MCA_DDRPHY_PC_RANK_GROUP_P0_ADDR_MIRROR_RP1_SEC,
            MCA_DDRPHY_PC_RANK_GROUP_EXT_P0_ADDR_MIRROR_RP1_TER,
            MCA_DDRPHY_PC_RANK_GROUP_EXT_P0_ADDR_MIRROR_RP1_QUA,
        };
};

///
/// @class rankPairTraits
/// @brief a collection of traits associated with the Nimbus PHY rank pair 2
///
template<>
class rankPairTraits< fapi2::TARGET_TYPE_MCA, 2 >
{
    public:
        enum
        {
            NUM_RANK_PAIR_REGS = 2,
            NUM_RANKS_IN_PAIR = 4,
        };

        // MCA rank config registers
        static const std::vector< uint64_t > RANK_PAIR_REGS;

        // Mapping for which fields below (primary, secondary, ...) go into which regs
        static const std::vector< uint64_t > RANK_PAIR_FIELD_MAP;

        // MCA rank and valid fields.
        constexpr static const uint64_t RANK_PAIR_FIELDS[] =
        {
            MCA_DDRPHY_PC_RANK_PAIR1_P0_PAIR2_PRI,
            MCA_DDRPHY_PC_RANK_PAIR1_P0_PAIR2_SEC,
            MCA_DDRPHY_PC_RANK_PAIR3_P0_PAIR2_TER,
            MCA_DDRPHY_PC_RANK_PAIR3_P0_PAIR2_QUA,
        };
        constexpr static const uint64_t RANK_PAIR_LENGTHS[] =
        {
            MCA_DDRPHY_PC_RANK_PAIR1_P0_PAIR2_PRI_LEN,
            MCA_DDRPHY_PC_RANK_PAIR1_P0_PAIR2_SEC_LEN,
            MCA_DDRPHY_PC_RANK_PAIR3_P0_PAIR2_TER_LEN,
            MCA_DDRPHY_PC_RANK_PAIR3_P0_PAIR2_QUA_LEN,
        };
        constexpr static const uint64_t RANK_PAIR_VALIDS[] =
        {
            MCA_DDRPHY_PC_RANK_PAIR1_P0_PAIR2_PRI_V,
            MCA_DDRPHY_PC_RANK_PAIR1_P0_PAIR2_SEC_V,
            MCA_DDRPHY_PC_RANK_PAIR3_P0_PAIR2_TER_V,
            MCA_DDRPHY_PC_RANK_PAIR3_P0_PAIR2_QUA_V,
        };
        // PHY RANK_GROUP register ADDR_MIRROR fields, indexed by rank ordinal
        constexpr static const uint64_t ADDR_MIRROR[] =
        {
            MCA_DDRPHY_PC_RANK_GROUP_P0_ADDR_MIRROR_RP2_PRI,
            MCA_DDRPHY_PC_RANK_GROUP_P0_ADDR_MIRROR_RP2_SEC,
            MCA_DDRPHY_PC_RANK_GROUP_EXT_P0_ADDR_MIRROR_RP2_TER,
            MCA_DDRPHY_PC_RANK_GROUP_EXT_P0_ADDR_MIRROR_RP2_QUA,
        };
};

///
/// @class rankPairTraits
/// @brief a collection of traits associated with the Nimbus PHY rank pair 3
///
template<>
class rankPairTraits< fapi2::TARGET_TYPE_MCA, 3 >
{
    public:
        enum
        {
            NUM_RANK_PAIR_REGS = 2,
            NUM_RANKS_IN_PAIR = 4,
        };

        // MCA rank config registers
        static const std::vector< uint64_t > RANK_PAIR_REGS;

        // Mapping for which fields below (primary, secondary, ...) go into which regs
        static const std::vector< uint64_t > RANK_PAIR_FIELD_MAP;

        // MCA rank and valid fields.
        constexpr static const uint64_t RANK_PAIR_FIELDS[] =
        {
            MCA_DDRPHY_PC_RANK_PAIR1_P0_PAIR3_PRI,
            MCA_DDRPHY_PC_RANK_PAIR1_P0_PAIR3_SEC,
            MCA_DDRPHY_PC_RANK_PAIR3_P0_TER,
            MCA_DDRPHY_PC_RANK_PAIR3_P0_QUA,
        };
        constexpr static const uint64_t RANK_PAIR_LENGTHS[] =
        {
            MCA_DDRPHY_PC_RANK_PAIR1_P0_PAIR3_PRI_LEN,
            MCA_DDRPHY_PC_RANK_PAIR1_P0_PAIR3_SEC_LEN,
            MCA_DDRPHY_PC_RANK_PAIR3_P0_TER_LEN,
            MCA_DDRPHY_PC_RANK_PAIR3_P0_QUA_LEN,
        };
        constexpr static const uint64_t RANK_PAIR_VALIDS[] =
        {
            MCA_DDRPHY_PC_RANK_PAIR1_P0_PAIR3_PRI_V,
            MCA_DDRPHY_PC_RANK_PAIR1_P0_PAIR3_SEC_V,
            MCA_DDRPHY_PC_RANK_PAIR3_P0_TER_V,
            MCA_DDRPHY_PC_RANK_PAIR3_P0_QUA_V,
        };
        // PHY RANK_GROUP register ADDR_MIRROR fields, indexed by rank ordinal
        constexpr static const uint64_t ADDR_MIRROR[] =
        {
            MCA_DDRPHY_PC_RANK_GROUP_P0_ADDR_MIRROR_RP3_PRI,
            MCA_DDRPHY_PC_RANK_GROUP_P0_ADDR_MIRROR_RP3_SEC,
            MCA_DDRPHY_PC_RANK_GROUP_EXT_P0_ADDR_MIRROR_RP3_TER,
            MCA_DDRPHY_PC_RANK_GROUP_EXT_P0_ADDR_MIRROR_RP3_QUA,
        };
};

// TODO RTC:160717 Tidy up function names in mss::rank namespace
namespace rank
{

///
/// @brief Maps a rank's canonical number to the proper ordinal number for the PHY
/// @param[in] i_count the number of DIMM to be considered
/// @param[in] i_rank the rank number to be mapped
/// @return the mapped value
// i_rank passed by value to save a local variable in the caller
///
template <fapi2::TargetType T>
inline uint64_t map_rank_ordinal_to_phy( const size_t i_count, const uint64_t i_rank );

///
/// @brief Maps a rank's canonical number to the proper ordinal number for the PHY
/// @param[in] i_count the number of DIMM to be considered
/// @param[in] i_rank the rank number to be mapped
/// @return the mapped value
// i_rank passed by value to save a local
///
template <>
inline uint64_t map_rank_ordinal_to_phy<fapi2::TARGET_TYPE_MCA>( const size_t i_count, const uint64_t i_rank )
{
    if (i_count == 0)
    {
        FAPI_ERR("seeing 0 DIMM?");
        fapi2::Assert(false);
    }

    if ((i_count == MAX_DIMM_PER_PORT) && (i_rank >= RANK_MID_POINT))
    {
        return i_rank - MAX_RANKS_DIMM1;
    }

    // Nothing to do in the single drop case. Nothing to do for {0,1} on a dual drop either
    return i_rank;
}

///
/// @brief Maps a rank's canonical number to the proper ordinal number for the PHY
/// @param[in] i_target the fapi2 target of the MCA
/// @param[in] i_rank the rank number to be mapped
/// @return the mapped value
// i_rank passed by value to save a local
///
inline uint64_t map_rank_ordinal_to_phy( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target, const uint64_t i_rank )
{
    return map_rank_ordinal_to_phy<fapi2::TARGET_TYPE_MCA>(count_dimm(i_target), i_rank);
}

///
/// @brief Maps a ranks canonical number to the proper ordinal number
/// for the PHY
/// @param[in] i_target the fapi2 target of the MBA
/// @param[in] i_rank the rank number to be mapped
/// @return the mapped value
// i_rank passed by value to save a local
///
inline uint64_t map_rank_ordinal_to_phy( const fapi2::Target<fapi2::TARGET_TYPE_MBA>& i_target, const uint64_t i_rank )
{
    // NOOP for Centaur
    return i_rank;
}

///
/// @brief Maps a rank's canonical number from the proper ordinal number for the PHY
/// @param[in] i_count the number of DIMM to be considered
/// @param[in] i_rank the rank number to be mapped
/// @return the mapped value
// i_rank passed by value to save a local
///
template <fapi2::TargetType T>
inline uint64_t map_rank_ordinal_from_phy( const size_t i_count, const uint64_t i_rank );

///
/// @brief Maps a rank's canonical number from the proper ordinal number for the PHY
/// @param[in] i_count the number of DIMM to be considered
/// @param[in] i_rank the rank number to be mapped
/// @return the mapped value
// i_rank passed by value to save a local
///
template <>
inline uint64_t map_rank_ordinal_from_phy<fapi2::TARGET_TYPE_MCA>( const size_t i_count, const uint64_t i_rank )
{
    if (i_count == 0)
    {
        FAPI_ERR("seeing 0 DIMM?");
        fapi2::Assert(false);
    }

    if ((i_count == MAX_DIMM_PER_PORT) && ((i_rank + MAX_RANKS_DIMM1) >= RANK_MID_POINT))
    {
        return i_rank + MAX_RANKS_DIMM1;
    }

    // Nothing to do in the single drop case. Nothing to do for {0,1} on a dual drop either
    return i_rank;
}

///
/// @brief Maps a rank's canonical number from the proper ordinal number for the PHY
/// @param[in] i_target the fapi2 target of the MCA
/// @param[in] i_rank the rank number to be mapped
/// @return the mapped value
// i_rank passed by value to save a local
///
inline uint64_t map_rank_ordinal_from_phy( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target,
        const uint64_t i_rank )
{
    return map_rank_ordinal_from_phy<fapi2::TARGET_TYPE_MCA>(count_dimm(i_target), i_rank);
}

///
/// @brief Maps a ranks canonical number to the proper ordinal number
/// for the PHY
/// @param[in] i_target the fapi2 target of the MBA
/// @param[in] i_rank the rank number to be mapped
/// @return the mapped value
// i_rank passed by value to save a local
///
inline uint64_t map_rank_ordinal_from_phy( const fapi2::Target<fapi2::TARGET_TYPE_MBA>& i_target,
        const uint64_t i_rank )
{
    // NOOP for Centaur
    return i_rank;
}

///
/// @brief Maps a ordinal rank pair to INIT_CAL_ERROR register encoding
/// @param[in] i_target the fapi2 target of the MCA
/// @param[in] i_rp rank pair 0-3
/// @param[out] o_encoding
/// @return the mapped value
// i_rank passed by value to save a local
///
inline fapi2::ReturnCode map_rp_primary_to_init_cal( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target,
        const uint64_t i_rp,
        uint64_t& o_encoding)
{
    typedef pcTraits<fapi2::TARGET_TYPE_MCA> TT;
    fapi2::buffer<uint64_t> l_temp;

    FAPI_ASSERT( i_rp < MAX_RANK_PAIRS,
                 fapi2::MSS_INVALID_RANK_PAIR()
                 .set_RANK_PAIR(i_rp)
                 .set_MCA_TARGET(i_target)
                 .set_FUNCTION(MAP_RP_PRIMARY_TO_INIT_CAL),
                 "Error in map_rp_primary_init_cal for %s on rp %d",
                 mss::c_str(i_target),
                 i_rp);

    FAPI_INF("Setting bit for rp %d", i_rp);
    //INIT_CAL_ERROR == 60, the bit position offset for the register
    FAPI_TRY( l_temp.setBit(i_rp + TT::INIT_CAL_ERROR_RANK_PAIR) );

    o_encoding = l_temp;
    return fapi2::FAPI2_RC_SUCCESS;
fapi_try_exit:
    return fapi2::current_err;
}
///
/// @brief Convert rank indexes in a rank_pair reg value from MC perspective to PHY perspective
/// @tparam T fapi2 Target Type the type of the MC target
/// @param[in] i_target the fapi2 target of the MCA
/// @param[in] i_count the number of DIMM to be considered
/// @param[in] i_rp_reg value of RANK_PAIR register
/// @param[in, out] io_data the register value with mapped rank indexes
/// @return FAPI2_RC_SUCCESS iff all is ok
///
template< fapi2::TargetType T >
inline fapi2::ReturnCode map_rank_pair_to_phy( const fapi2::Target<T>& i_target,
        const size_t i_count,
        const fapi2::buffer<uint64_t>& i_rp_reg_value,
        fapi2::buffer<uint64_t>& io_data );

///
/// @brief Convert rank indexes in a rank_pair reg value from MC perspective to PHY perspective
/// @param[in] i_target the fapi2 target of the MCA
/// @param[in] i_count the number of DIMM to be considered
/// @param[in] i_rp_reg value of RANK_PAIR register
/// @param[in, out] io_data the register value with mapped rank indexes
/// @return FAPI2_RC_SUCCESS iff all is ok
///
template<>
inline fapi2::ReturnCode map_rank_pair_to_phy( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target,
        const size_t i_count,
        const fapi2::buffer<uint64_t>& i_rp_reg_value,
        fapi2::buffer<uint64_t>& io_data )
{
    uint64_t l_rank = 0;

    FAPI_ASSERT(i_count != 0,
                fapi2::MSS_NO_DIMM_FOR_MAPPING()
                .set_MCA_TARGET(i_target)
                .set_FUNCTION(RANK_PAIR_TO_PHY),
                "%s Tried to map rank pairs on a port without any DIMMs",
                mss::c_str(i_target));

    // copy over so we get the valid bits
    io_data = i_rp_reg_value;

    // No mapping necessary if single drop
    if (i_count != 1)
    {
        i_rp_reg_value.extractToRight<EVEN_PRIMARY_RANK, RANK_LEN>(l_rank);
        l_rank = map_rank_ordinal_to_phy<fapi2::TARGET_TYPE_MCA>(i_count, l_rank);
        io_data.insertFromRight<EVEN_PRIMARY_RANK, RANK_LEN>(l_rank);

        i_rp_reg_value.extractToRight<EVEN_SECONDARY_RANK, RANK_LEN>(l_rank);
        l_rank = map_rank_ordinal_to_phy<fapi2::TARGET_TYPE_MCA>(i_count, l_rank);
        io_data.insertFromRight<EVEN_SECONDARY_RANK, RANK_LEN>(l_rank);

        i_rp_reg_value.extractToRight<ODD_PRIMARY_RANK, RANK_LEN>(l_rank);
        l_rank = map_rank_ordinal_to_phy<fapi2::TARGET_TYPE_MCA>(i_count, l_rank);
        io_data.insertFromRight<ODD_PRIMARY_RANK, RANK_LEN>(l_rank);

        i_rp_reg_value.extractToRight<ODD_SECONDARY_RANK, RANK_LEN>(l_rank);
        l_rank = map_rank_ordinal_to_phy<fapi2::TARGET_TYPE_MCA>(i_count, l_rank);
        io_data.insertFromRight<ODD_SECONDARY_RANK, RANK_LEN>(l_rank);
    }

    return fapi2::FAPI2_RC_SUCCESS;
fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief Convert rank indexes in a rank_pair reg value from MC perspective to PHY perspective
/// @param[in] i_target the fapi2 target of the MCA
/// @param[in] i_rp_reg value of RANK_PAIR register
/// @param[in, out] io_data the register value with mapped rank indexes
/// @return FAPI2_RC_SUCCESS iff all is ok
///
inline fapi2::ReturnCode map_rank_pair_to_phy( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target,
        const fapi2::buffer<uint64_t>& i_rp_reg_value,
        fapi2::buffer<uint64_t>& io_data )
{
    return map_rank_pair_to_phy(i_target, count_dimm(i_target), i_rp_reg_value, io_data);
}

///
/// @brief Convert rank indexes in a rank_pair reg value from MC perspective to PHY perspective
/// @param[in] i_target the fapi2 target of the MCA
/// @param[in] i_rp_reg value of RANK_PAIR register
/// @param[in, out] io_data the register value with mapped rank indexes
/// @return FAPI2_RC_SUCCESS iff all is ok
///
inline fapi2::ReturnCode map_rank_pair_to_phy( const fapi2::Target<fapi2::TARGET_TYPE_MBA>& i_target,
        const fapi2::buffer<uint64_t>& i_rp_reg_value,
        fapi2::buffer<uint64_t>& io_data )
{
    // NOOP for Centaur
    io_data = i_rp_reg_value;
    return fapi2::FAPI2_RC_SUCCESS;
}

///
/// @brief Convert rank indexes in a rank_pair reg value from PHY perspective to MC perspective
/// @tparam T fapi2 Target Type the type of the MC target
/// @param[in] i_target the fapi2 target of the MCA
/// @param[in] i_count the number of DIMM to be considered
/// @param[in] i_rp_reg value of RANK_PAIR register
/// @param[in, out] io_data the register value with mapped rank indexes
/// @return FAPI2_RC_SUCCESS iff all is ok
///
template< fapi2::TargetType T >
inline fapi2::ReturnCode map_rank_pair_from_phy( const fapi2::Target<T>& i_target,
        const size_t i_count,
        const fapi2::buffer<uint64_t>& i_rp_reg_value,
        fapi2::buffer<uint64_t>& io_data );

///
/// @brief Convert rank indexes in a rank_pair reg value from PHY perspective to MC perspective
/// Specialization for TARGET_TYPE_MCA
/// @param[in] i_target the fapi2 target of the MCA
/// @param[in] i_count the number of DIMM to be considered
/// @param[in] i_rp_reg value of RANK_PAIR register
/// @param[in, out] io_data the register value with mapped rank indexes
/// @return FAPI2_RC_SUCCESS iff all is ok
///
template<>
inline fapi2::ReturnCode map_rank_pair_from_phy( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target,
        const size_t i_count,
        const fapi2::buffer<uint64_t>& i_rp_reg_value,
        fapi2::buffer<uint64_t>& io_data )
{
    uint64_t l_rank = 0;

    FAPI_ASSERT(i_count != 0,
                fapi2::MSS_NO_DIMM_FOR_MAPPING()
                .set_FUNCTION(RANK_PAIR_FROM_PHY)
                .set_MCA_TARGET(i_target),
                "%s Tried to map rank pairs on a port without any DIMMs",
                mss::c_str(i_target));

    // copy over so we get the valid bits
    io_data = i_rp_reg_value;

    // No mapping necessary if single drop
    if (i_count != 1)
    {
        i_rp_reg_value.extractToRight<EVEN_PRIMARY_RANK, RANK_LEN>(l_rank);
        l_rank = map_rank_ordinal_from_phy<fapi2::TARGET_TYPE_MCA>(i_count, l_rank);
        io_data.insertFromRight<EVEN_PRIMARY_RANK, RANK_LEN>(l_rank);

        i_rp_reg_value.extractToRight<EVEN_SECONDARY_RANK, RANK_LEN>(l_rank);
        l_rank = map_rank_ordinal_from_phy<fapi2::TARGET_TYPE_MCA>(i_count, l_rank);
        io_data.insertFromRight<EVEN_SECONDARY_RANK, RANK_LEN>(l_rank);

        i_rp_reg_value.extractToRight<ODD_PRIMARY_RANK, RANK_LEN>(l_rank);
        l_rank = map_rank_ordinal_from_phy<fapi2::TARGET_TYPE_MCA>(i_count, l_rank);
        io_data.insertFromRight<ODD_PRIMARY_RANK, RANK_LEN>(l_rank);

        i_rp_reg_value.extractToRight<ODD_SECONDARY_RANK, RANK_LEN>(l_rank);
        l_rank = map_rank_ordinal_from_phy<fapi2::TARGET_TYPE_MCA>(i_count, l_rank);
        io_data.insertFromRight<ODD_SECONDARY_RANK, RANK_LEN>(l_rank);
    }

    return fapi2::FAPI2_RC_SUCCESS;
fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief Convert rank indexes in a rank_pair reg value from PHY perspective to MC perspective
/// @param[in] i_target the fapi2 target of the MCA
/// @param[in] i_rp_reg value of RANK_PAIR register
/// @param[in, out] io_data the register value with mapped rank indexes
/// @return FAPI2_RC_SUCCESS iff all is ok
///
inline fapi2::ReturnCode map_rank_pair_from_phy( const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target,
        const fapi2::buffer<uint64_t>& i_rp_reg_value,
        fapi2::buffer<uint64_t>& io_data )
{
    return map_rank_pair_from_phy(i_target, count_dimm(i_target), i_rp_reg_value, io_data);
}

///
/// @brief Convert rank indexes in a rank_pair reg value from PHY perspective to MC perspective
/// @param[in] i_target the fapi2 target of the MCA
/// @param[in] i_rp_reg value of RANK_PAIR register
/// @param[in, out] io_data the register value with mapped rank indexes
/// @return FAPI2_RC_SUCCESS iff all is ok
///
inline fapi2::ReturnCode map_rank_pair_from_phy( const fapi2::Target<fapi2::TARGET_TYPE_MBA>& i_target,
        const fapi2::buffer<uint64_t>& i_rp_reg_value,
        fapi2::buffer<uint64_t>& io_data )
{
    // NOOP for Centaur
    io_data = i_rp_reg_value;
    return fapi2::FAPI2_RC_SUCCESS;
}

///
/// @brief Return a vector of rank numbers which represent the ranks for this dimm
/// @tparam T the target type you'd like the associated ranks for
/// @param[in] i_target
/// @param[out] o_ranks a vector of ranks (numbers)
/// @return FAPI2_RC_SUCCESS iff all is ok
///
template< fapi2::TargetType T >
fapi2::ReturnCode ranks( const fapi2::Target<T>& i_target, std::vector< uint64_t >& o_ranks );

///
/// @brief Return a vector of rank numbers which represent the primary rank pairs for this port or dimm
/// @tparam T the target type
/// @param[in] i_target TARGET_TYPE_MCA or TARGET_TYPEDIMM
/// @param[out] o_rps a vector of rank_pairs
/// @return FAPI@_RC_SUCCESS iff all is ok
///
template< fapi2::TargetType T >
fapi2::ReturnCode primary_ranks( const fapi2::Target<T>& i_target, std::vector< uint64_t >& o_rps );

///
/// @brief Return true iff this rank is on thie DIMM
/// @param[in] i_target representing the DIMM
/// @param[in] i_rank the rank number.
/// @return true iff i_rank is a rank on i_target
///
bool is_rank_on_dimm(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, const uint64_t i_rank);

///
/// @brief Return the *port relative position* of the DIMM which posesses this rank
/// @param[in] i_rank the rank number.
/// @return the relative position of the DIMM which contains this rank.
///
size_t get_dimm_from_rank(const uint64_t i_rank);

///
/// @brief Return the DIMM target which posesses this rank on a given port
/// @tparam T the fapi2::TargetType of the port
/// @tparam D the fapi2::TargetType of the DIMM
/// @param[in] i_target the port target
/// @param[in] i_rank the rank number
/// @param[out] o_dimm the DIMM target
/// @return FAPI2_RC_SUCCESS iff all is ok, FAPI2_RC_INVALID_PARAMETER otherwise
///
template< fapi2::TargetType T, fapi2::TargetType D >
fapi2::ReturnCode get_dimm_target_from_rank(const fapi2::Target<T>& i_target,
        const uint64_t i_rank,
        fapi2::Target<D>& o_dimm);

///
/// @brief Given a target, get the rank pair assignments, based on DIMMs
/// @tparam T the fapi2::TargetType
/// @param[in] i_target the target (MCA or MBA?)
/// @param[out] o_registers the regiter settings for the appropriate rank pairs
/// @return FAPI2_RC_SUCCESS if and only if ok
///
template< fapi2::TargetType T>
fapi2::ReturnCode get_rank_pair_assignments(const fapi2::Target<T>& i_target,
        std::pair<uint64_t, uint64_t>& o_registers);

///
/// @brief Setup the rank information in the port
/// @tparam T the fapi2::TargetType
/// @param[in] i_target the target (MCA or MBA?)
/// @return FAPI2_RC_SUCCESS if and only if ok
///
template< fapi2::TargetType T>
fapi2::ReturnCode set_rank_pairs(const fapi2::Target<T>& i_target);

///
/// @brief get the rank information related to the port
/// @tparam T the fapi2::TargetType
/// @param[in] i_target the target (MCA or MBA?)
/// @param[out] o_pairs std::vector of rank pairs configured
/// @return FAPI2_RC_SUCCESS if and only if ok
///
template< fapi2::TargetType T>
fapi2::ReturnCode get_rank_pairs(const fapi2::Target<T>& i_target, std::vector<uint64_t>& o_pairs);

///
/// @brief Get a rank-pair id from a physical rank
/// Returns a number representing which rank-pair this rank is a part of
/// @tparam T the fapi2::TargetType
/// @param[in] i_target  the target (MCA or MBA?)
/// @param[in] i_rank the physical rank number
/// @param[out] o_pairs the rank pair
/// @return FAPI2_RC_SUCCESS if and only if ok, FAPI2_RC_INVALID_PARAMETER if the rank isn't found
///
template< fapi2::TargetType T>
fapi2::ReturnCode get_pair_from_rank(const fapi2::Target<T>& i_target, const uint64_t i_rank, uint64_t& o_pair);

///
/// @brief Read PC Rank Pair register
/// @tparam RP rank pair index
/// @tparam N register index
/// @tparam T fapi2 Target Type - derived from i_target's type
/// @tparam TT traits type defaults to rankPairTraits<T, RP>
/// @param[in] i_target the fapi2 target of the mc
/// @param[out] o_data the value of the register
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
///
template< uint64_t RP, uint64_t N, fapi2::TargetType T, typename TT = rankPairTraits<T, RP> >
inline fapi2::ReturnCode read_rank_pair_reg( const fapi2::Target<T>& i_target, fapi2::buffer<uint64_t>& o_data )
{
    fapi2::buffer<uint64_t> l_buf;
    static_assert((N < TT::NUM_RANK_PAIR_REGS), "Rank pair register index failed range check");
    FAPI_TRY( mss::getScom(i_target, TT::RANK_PAIR_REGS[N], l_buf) );
    FAPI_INF("%s read_rank_pair_reg: 0x%016lx", mss::c_str(i_target), l_buf);
    FAPI_TRY( map_rank_pair_from_phy(i_target, l_buf, o_data) );
fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief Write PC Rank Pair register
/// @tparam RP rank pair register index
/// @tparam N register index
/// @tparam T fapi2 Target Type - derived from i_target's type
/// @tparam TT traits type defaults to rankPairTraits<T, RP>
/// @param[in] i_target the fapi2 target of the mc
/// @param[in] i_data the value to write to the register
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
///
template< uint64_t RP, uint64_t N, fapi2::TargetType T, typename TT = rankPairTraits<T, RP> >
inline fapi2::ReturnCode write_rank_pair_reg( const fapi2::Target<T>& i_target, const fapi2::buffer<uint64_t>& i_data )
{
    fapi2::buffer<uint64_t> l_buf;
    static_assert((N < TT::NUM_RANK_PAIR_REGS), "Rank pair register index failed range check");
    FAPI_TRY( map_rank_pair_to_phy(i_target, i_data, l_buf) );
    FAPI_TRY( mss::putScom(i_target, TT::RANK_PAIR_REGS[N], l_buf) );
    FAPI_INF("%s write_rank_pair_reg: 0x%016lx", mss::c_str(i_target), l_buf);
fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief Read PC Rank Group register
/// @tparam T fapi2 Target Type - derived from i_target's type
/// @tparam TT traits type defaults to rankPairTraits<T, 0>
/// @param[in] i_target the fapi2 target of the mc
/// @param[out] o_data the value of the register
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
///
template< fapi2::TargetType T, typename TT = rankPairTraits<T, 0> >
inline fapi2::ReturnCode read_rank_group( const fapi2::Target<T>& i_target, fapi2::buffer<uint64_t>& o_data )
{
    FAPI_TRY( mss::getScom(i_target, TT::RANK_GROUP, o_data) );
    FAPI_INF("%s read_rank_group: 0x%016lx", mss::c_str(i_target), o_data);
fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief Write PC Rank Group register
/// @tparam T fapi2 Target Type - derived from i_target's type
/// @tparam TT traits type defaults to rankPairTraits<T, 0>
/// @param[in] i_target the fapi2 target of the mc
/// @param[in] i_data the value to write to the register
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
///
template< fapi2::TargetType T, typename TT = rankPairTraits<T, 0> >
inline fapi2::ReturnCode write_rank_group( const fapi2::Target<T>& i_target, const fapi2::buffer<uint64_t>& i_data )
{
    FAPI_TRY( mss::putScom(i_target, TT::RANK_GROUP, i_data) );
    FAPI_INF("%s write_rank_group: 0x%016lx", mss::c_str(i_target), i_data);
fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief Read PC Rank Group Extension register
/// @tparam T fapi2 Target Type - derived from i_target's type
/// @tparam TT traits type defaults to rankPairTraits<T, 0>
/// @param[in] i_target the fapi2 target of the mc
/// @param[out] o_data the value of the register
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
///
template< fapi2::TargetType T, typename TT = rankPairTraits<T, 0> >
inline fapi2::ReturnCode read_rank_group_ext( const fapi2::Target<T>& i_target, fapi2::buffer<uint64_t>& o_data )
{
    FAPI_TRY( mss::getScom(i_target, TT::RANK_GROUP_EXT, o_data) );
    FAPI_INF("%s read_rank_group_ext: 0x%016lx", mss::c_str(i_target), o_data);
fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief Write PC Rank Group Extension register
/// @tparam T fapi2 Target Type - derived from i_target's type
/// @tparam TT traits type defaults to rankPairTraits<T, 0>
/// @param[in] i_target the fapi2 target of the mc
/// @param[in] i_data the value to write to the register
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
///
template< fapi2::TargetType T, typename TT = rankPairTraits<T, 0> >
inline fapi2::ReturnCode write_rank_group_ext( const fapi2::Target<T>& i_target, const fapi2::buffer<uint64_t>& i_data )
{
    FAPI_TRY( mss::putScom(i_target, TT::RANK_GROUP_EXT, i_data) );
    FAPI_INF("%s write_rank_group_ext: 0x%016lx", mss::c_str(i_target), i_data);
fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief set_rank_field
/// @tparam RP rank pair (group) index
/// @tparam R rank index in pair (PRIMARY, SECONDARY, etc)
/// @tparam T fapi2 Target Type
/// @tparam TT traits type defaults to rankPairTraits<T, RP>
/// @param[in, out] io_data the register value
/// @param[in] i_value rank number
/// @note When configured for a protocol that only supports a single rank system, the rankpair 0 primary
///       rank must be set to 0
///
template< uint64_t RP, uint64_t R, fapi2::TargetType T = fapi2::TARGET_TYPE_MCA, typename TT = rankPairTraits<T, RP> >
inline void set_rank_field( fapi2::buffer<uint64_t>& io_data, const uint64_t i_value )
{
    static_assert((R < TT::NUM_RANKS_IN_PAIR), "Rank index failed range check");
    io_data.insertFromRight<TT::RANK_PAIR_FIELDS[R], TT::RANK_PAIR_LENGTHS[R]>(i_value);
    // also set valid field
    io_data.writeBit<TT::RANK_PAIR_VALIDS[R]>(mss::YES);

    FAPI_INF("set_rank_field (rp%d, r%d): 0x%01lx", RP, R, i_value);
}

///
/// @brief set_rank_field
/// @tparam RP rank pair (group) index
/// @tparam T fapi2 Target Type
/// @tparam TT traits type defaults to rankPairTraits<T, RP>
/// @param[in] i_target the fapi2 target of the mc
/// @param[in, out] io_data the register value
/// @param[i] i_rank rank index in pair (PRIMARY, SECONDARY, etc)
/// @param[in] i_value rank number
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
/// @note When configured for a protocol that only supports a single rank system, the rankpair 0 primary
///       rank must be set to 0
///
template< uint64_t RP, fapi2::TargetType T, typename TT = rankPairTraits<T, RP> >
inline fapi2::ReturnCode set_rank_field( const fapi2::Target<T>& i_target,
        fapi2::buffer<uint64_t>& io_data,
        const uint64_t i_rank,
        const uint64_t i_value )
{
    switch (i_rank)
    {
        case(0):
            set_rank_field<RP, 0>(io_data, i_value);
            return fapi2::FAPI2_RC_SUCCESS;

        case(1):
            set_rank_field<RP, 1>(io_data, i_value);
            return fapi2::FAPI2_RC_SUCCESS;

        case(2):
            set_rank_field<RP, 2>(io_data, i_value);
            return fapi2::FAPI2_RC_SUCCESS;

        case(3):
            set_rank_field<RP, 3>(io_data, i_value);
            return fapi2::FAPI2_RC_SUCCESS;

        default:
            FAPI_ASSERT( false,
                         fapi2::MSS_INVALID_RANK()
                         .set_RANK(i_rank)
                         .set_MCA_TARGET(i_target)
                         .set_FUNCTION(SET_RANK_FIELD),
                         "%s Invalid rank (%d) in set_rank_field",
                         mss::c_str(i_target),
                         i_rank);
    }

    return fapi2::FAPI2_RC_SUCCESS;
fapi_try_exit:
    return fapi2::current_err;
}
///
/// @brief get_rank_field
/// @tparam RP rank pair (group) index
/// @tparam R rank index in pair (PRIMARY, SECONDARY, etc)
/// @tparam T fapi2 Target Type
/// @tparam TT traits type defaults to rankPairTraits<T, RP>
/// @param[in] i_data the register value
/// @param[out] o_value rank number
///
template< uint64_t RP, uint64_t R, fapi2::TargetType T = fapi2::TARGET_TYPE_MCA, typename TT = rankPairTraits<T, RP> >
inline void get_rank_field( const fapi2::buffer<uint64_t>& i_data, uint64_t& o_value )
{
    static_assert((R < TT::NUM_RANKS_IN_PAIR), "Rank index failed range check");
    i_data.extractToRight<TT::RANK_PAIR_FIELDS[R], TT::RANK_PAIR_LENGTHS[R]>(o_value);

    FAPI_INF("get_rank_field (rp%d, r%d): 0x%01lx", RP, R, o_value);
}

///
/// @brief get_rank_field
/// @tparam RP rank pair (group) index
/// @tparam T fapi2 Target Type
/// @tparam TT traits type defaults to rankPairTraits<T, RP>
/// @param[in] i_target the fapi2 target of the mc
/// @param[in] i_data the register value
/// @param[i] i_rank rank index in pair (PRIMARY, SECONDARY, etc)
/// @param[out] o_value rank number
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
///
template< uint64_t RP, fapi2::TargetType T, typename TT = rankPairTraits<T, RP> >
inline fapi2::ReturnCode get_rank_field( const fapi2::Target<T>& i_target,
        fapi2::buffer<uint64_t>& i_data,
        const uint64_t i_rank,
        uint64_t& o_value )
{
    switch (i_rank)
    {
        case(0):
            get_rank_field<RP, 0>(i_data, o_value);
            return fapi2::FAPI2_RC_SUCCESS;

        case(1):
            get_rank_field<RP, 1>(i_data, o_value);
            return fapi2::FAPI2_RC_SUCCESS;

        case(2):
            get_rank_field<RP, 2>(i_data, o_value);
            return fapi2::FAPI2_RC_SUCCESS;

        case(3):
            get_rank_field<RP, 3>(i_data, o_value);
            return fapi2::FAPI2_RC_SUCCESS;

        default:
            FAPI_ASSERT( false,
                         fapi2::MSS_INVALID_RANK()
                         .set_RANK(i_rank)
                         .set_MCA_TARGET(i_target)
                         .set_FUNCTION(GET_RANK_FIELD),
                         "%s Invalid rank (%d) in get_ranks_in_pair",
                         mss::c_str(i_target),
                         i_rank);
    }

    return fapi2::FAPI2_RC_SUCCESS;
fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief set_pair_valid
/// @tparam RP rank pair (group) index
/// @tparam R rank index in pair (PRIMARY, SECONDARY, etc)
/// @tparam T fapi2 Target Type defaults to TARGET_TYPE_MCA
/// @tparam TT traits type defaults to rankPairTraits<T, RP>
/// @param[in, out] io_data the register value
/// @param[in] i_state mss::YES or mss::NO - desired state
/// @note Indicates value in the RANK_PAIR field is valid
///
template< uint64_t RP, uint64_t R, fapi2::TargetType T = fapi2::TARGET_TYPE_MCA, typename TT = rankPairTraits<T, RP> >
inline void set_pair_valid( fapi2::buffer<uint64_t>& io_data, const mss::states i_state )
{
    static_assert((R < TT::NUM_RANKS_IN_PAIR), "Rank index failed range check");
    io_data.writeBit<TT::RANK_PAIR_VALIDS[R]>(i_state);

    FAPI_INF("set_pair_valid (rp%d, r%d): 0x%01lx", RP, R, i_state);
}

///
/// @brief set_pair_valid
/// @tparam RP rank pair (group) index
/// @tparam T fapi2 Target
/// @tparam TT traits type defaults to rankPairTraits<T, RP>
/// @param[in] i_target the fapi2 target of the mc
/// @param[in, out] io_data the register value
/// @param[in] i_rank rank index in pair (PRIMARY, SECONDARY, etc)
/// @param[in] i_state mss::YES or mss::NO - desired state
/// @note Indicates value in the RANK_PAIR field is valid
///
template< uint64_t RP, fapi2::TargetType T, typename TT = rankPairTraits<T, RP> >
inline fapi2::ReturnCode set_pair_valid( const fapi2::Target<T>& i_target,
        fapi2::buffer<uint64_t>& io_data,
        const uint64_t i_rank,
        const mss::states i_state )
{
    switch (i_rank)
    {
        case(0):
            set_pair_valid<RP, 0>(io_data, i_state);
            return fapi2::FAPI2_RC_SUCCESS;

        case(1):
            set_pair_valid<RP, 1>(io_data, i_state);
            return fapi2::FAPI2_RC_SUCCESS;

        case(2):
            set_pair_valid<RP, 2>(io_data, i_state);
            return fapi2::FAPI2_RC_SUCCESS;

        case(3):
            set_pair_valid<RP, 3>(io_data, i_state);
            return fapi2::FAPI2_RC_SUCCESS;

        default:
            FAPI_ASSERT( false,
                         fapi2::MSS_INVALID_RANK()
                         .set_RANK(i_rank)
                         .set_MCA_TARGET(i_target)
                         .set_FUNCTION(SET_PAIR_VALID),
                         "%s Invalid rank (%d) in get_ranks_in_pair",
                         mss::c_str(i_target),
                         i_rank);

    }

    return fapi2::FAPI2_RC_SUCCESS;
fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief get_pair_valid
/// @tparam RP rank pair (group) index
/// @tparam R rank index in pair (PRIMARY, SECONDARY, etc)
/// @tparam T fapi2 Target Type defaults to TARGET_TYPE_MCA
/// @tparam TT traits type defaults to rankPairTraits<T, RP>
/// @param[in] i_data the register value
/// @param[out] o_state mss::YES or mss::NO - representing the state of the field
/// @note Indicates value in the RANK_PAIR field is valid
///
template< uint64_t RP, uint64_t R, fapi2::TargetType T = fapi2::TARGET_TYPE_MCA, typename TT = rankPairTraits<T, RP> >
inline void get_pair_valid( const fapi2::buffer<uint64_t>& i_data, mss::states& o_state )
{
    static_assert((R < TT::NUM_RANKS_IN_PAIR), "Rank index failed range check");
    o_state = (i_data.getBit<TT::RANK_PAIR_VALIDS[R]>() == false) ? mss::NO : mss::YES;

    FAPI_INF("get_pair_valid (rp%d, r%d): 0x%01lx", RP, R, o_state);
}

///
/// @brief get_pair_valid
/// @tparam RP rank pair (group) index
/// @tparam T fapi2 Target Type
/// @tparam TT traits type defaults to rankPairTraits<T, RP>
/// @param[in] i_target the fapi2 target of the mc
/// @param[in] i_data the register value
/// @param[in] i_rank rank index in pair (PRIMARY, SECONDARY, etc)
/// @param[out] o_state mss::YES or mss::NO - representing the state of the field
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
/// @note Indicates value in the RANK_PAIR field is valid
///
template< uint64_t RP, fapi2::TargetType T, typename TT = rankPairTraits<T, RP> >
inline fapi2::ReturnCode get_pair_valid( const fapi2::Target<T> i_target,
        fapi2::buffer<uint64_t>& i_data,
        const uint64_t i_rank,
        mss::states& o_state )
{
    switch (i_rank)
    {
        case(0):
            get_pair_valid<RP, 0>(i_data, o_state);
            return fapi2::FAPI2_RC_SUCCESS;

        case(1):
            get_pair_valid<RP, 1>(i_data, o_state);
            return fapi2::FAPI2_RC_SUCCESS;

        case(2):
            get_pair_valid<RP, 2>(i_data, o_state);
            return fapi2::FAPI2_RC_SUCCESS;

        case(3):
            get_pair_valid<RP, 3>(i_data, o_state);
            return fapi2::FAPI2_RC_SUCCESS;

        default:
            FAPI_ASSERT( false,
                         fapi2::MSS_INVALID_RANK()
                         .set_RANK(i_rank)
                         .set_MCA_TARGET(i_target)
                         .set_FUNCTION(GET_PAIR_VALID),
                         "%s Invalid rank (%d) passed into get get_pair_valid",
                         mss::c_str(i_target),
                         i_rank);
    }

    return fapi2::FAPI2_RC_SUCCESS;
fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief set_ranks_in_pair
/// @tparam RP rank pair (group) index
/// @tparam T fapi2 Target Type - derived from i_target's type
/// @tparam TT traits type defaults to rankPairTraits<T, RP>
/// @param[in] i_target the fapi2 target of the mc
/// @param[in] i_ranks vector of rank numbers (primary, secondary, tertiary, quaternary)
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
/// @note All ranks will be marked as valid in the pair, unless specified as enum NO_RANK
///
template< uint64_t RP, fapi2::TargetType T, typename TT = rankPairTraits<T, RP> >
fapi2::ReturnCode set_ranks_in_pair( const fapi2::Target<T>& i_target,
                                     const std::vector<uint64_t> i_ranks )
{
    // Read the rank pair register(s)
    fapi2::buffer<uint64_t> l_reg;
    std::vector<fapi2::buffer<uint64_t>> l_data;
    uint64_t l_ordinal = 0;

    FAPI_ASSERT( i_ranks.size() == TT::NUM_RANKS_IN_PAIR,
                 fapi2::MSS_INVALID_RANK_VECTOR_PASSED_IN()
                 .set_RANK_SIZE(i_ranks.size())
                 .set_MCA_TARGET(i_target)
                 .set_FUNCTION(SET_RANKS_IN_PAIR),
                 "%s Invalid vector of ranks passed in (%d) ",
                 mss::c_str(i_target), i_ranks.size());

    // Use the reg API here so we get the PHY to MC rank conversion
    FAPI_TRY( (mss::rank::read_rank_pair_reg< RP, 0 >(i_target, l_reg)) );
    l_data.push_back(l_reg);
    FAPI_TRY( (mss::rank::read_rank_pair_reg< RP, 1 >(i_target, l_reg)) );
    l_data.push_back(l_reg);

    // Modify
    for (const auto l_rank : i_ranks)
    {
        if (l_rank == NO_RANK)
        {
            FAPI_TRY( set_pair_valid<RP>(i_target, l_data.at(TT::RANK_PAIR_FIELD_MAP[l_ordinal]), l_ordinal, mss::NO) );
        }
        else
        {
            FAPI_TRY( set_rank_field<RP>(i_target, l_data.at(TT::RANK_PAIR_FIELD_MAP[l_ordinal]), l_ordinal, l_rank) );
        }

        ++l_ordinal;
    }

    // Use the reg API here so we get the MC to PHY rank conversion
    FAPI_TRY( (mss::rank::write_rank_pair_reg< RP, 0 >(i_target, l_data[0])) );
    FAPI_TRY( (mss::rank::write_rank_pair_reg< RP, 1 >(i_target, l_data[1])) );

    return fapi2::FAPI2_RC_SUCCESS;
fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief Get the ordered list of ranks in a given pair
/// @tparam RP rank pair (group) index
/// @tparam T fapi2 Target Type - derived from i_target's type
/// @tparam TT traits type defaults to rankPairTraits<T, RP>
/// @param[in] i_target the fapi2 target of the mc
/// @param[out] o_ranks vector of rank numbers (primary, secondary, tertiary, quaternary)
/// @note Any ranks not marked as valid in the pair will be returned as enum NO_RANK
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
///
template< uint64_t RP, fapi2::TargetType T, typename TT = rankPairTraits<T, RP> >
fapi2::ReturnCode get_ranks_in_pair( const fapi2::Target<T>& i_target,
                                     std::vector<uint64_t>& o_ranks )
{
    static_assert(RP < MAX_RANK_PER_DIMM, "Passed in Rank Pair is too high");

    o_ranks.clear();

    // Read the rank pair register(s)
    fapi2::buffer<uint64_t> l_reg;
    std::vector<fapi2::buffer<uint64_t>> l_data;

    // Use the reg API here so we get the PHY to MC rank conversion
    FAPI_TRY( (mss::rank::read_rank_pair_reg< RP, 0 >(i_target, l_reg)) );
    l_data.push_back(l_reg);
    FAPI_TRY( (mss::rank::read_rank_pair_reg< RP, 1 >(i_target, l_reg)) );
    l_data.push_back(l_reg);

    // Get data
    for (uint64_t l_ordinal = 0; l_ordinal < TT::NUM_RANKS_IN_PAIR; ++l_ordinal)
    {
        // Check to make sure rank is valid
        FAPI_ASSERT( l_ordinal < MAX_RANK_PER_DIMM,
                     fapi2::MSS_INVALID_RANK()
                     .set_RANK(l_ordinal)
                     .set_MCA_TARGET(i_target)
                     .set_FUNCTION(GET_RANKS_IN_PAIR),
                     "%s Invalid rank (%d) in set_ranks_in_pair",
                     mss::c_str(i_target),
                     l_ordinal);

        mss::states l_state = mss::NO;

        FAPI_TRY( get_pair_valid<RP>(i_target, l_data.at(TT::RANK_PAIR_FIELD_MAP[l_ordinal]), l_ordinal, l_state) );

        if (l_state == mss::NO)
        {
            o_ranks.push_back(NO_RANK);
        }
        else
        {
            uint64_t l_rank = 0;
            FAPI_TRY( get_rank_field<RP>(i_target, l_data.at(TT::RANK_PAIR_FIELD_MAP[l_ordinal]), l_ordinal, l_rank) );
            o_ranks.push_back(l_rank);
        }
    }

fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief Get the ordered list of ranks in all pairs
/// @tparam T fapi2 Target Type - derived from i_target's type
/// @param[in] i_target the fapi2 target of the mc
/// @param[out] o_ranks vector of vectors of rank numbers (primary, secondary, tertiary, quaternary)
/// @note Any ranks not marked as valid in the pair will be returned as enum NO_RANK
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
///
template< fapi2::TargetType T >
fapi2::ReturnCode get_ranks_in_pairs( const fapi2::Target<T>& i_target,
                                      std::vector<std::vector<uint64_t>>& o_ranks )
{
    o_ranks.clear();
    std::vector<uint64_t> l_temp;

    FAPI_TRY( get_ranks_in_pair<0>( i_target, l_temp ) );
    o_ranks.push_back(l_temp);
    FAPI_TRY( get_ranks_in_pair<1>( i_target, l_temp ) );
    o_ranks.push_back(l_temp);
    FAPI_TRY( get_ranks_in_pair<2>( i_target, l_temp ) );
    o_ranks.push_back(l_temp);
    FAPI_TRY( get_ranks_in_pair<3>( i_target, l_temp ) );
    o_ranks.push_back(l_temp);

fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief Check whether a given rank needs to be mirrored
/// @tparam T fapi2 Target Type - derived from i_target's type
/// @param[in] i_target the fapi2 target of the mc
/// @param[in] i_rank rank number
/// @param[in] i_valid true if the rank is valid
/// @param[out] o_mirrored true if rank needs to be mirrored
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
///
template< fapi2::TargetType T >
fapi2::ReturnCode is_mirrored( const fapi2::Target<T>& i_target,
                               const uint64_t i_rank,
                               const bool i_valid,
                               bool& o_mirrored )
{
    uint8_t l_mirror[MAX_DIMM_PER_PORT] = {0};
    FAPI_TRY( eff_dimm_rcd_mirror_mode(i_target, l_mirror) );

    o_mirrored = false;

    // A rank is mirrored if all are true:
    //  - the rank is valid
    //  - the rank is odd
    //  - the mirror mode attribute is set for the rank's DIMM
    if (i_valid &&
        mss::is_odd(i_rank) &&
        (l_mirror[get_dimm_from_rank(i_rank)] == fapi2::ENUM_ATTR_EFF_DIMM_RCD_MIRROR_MODE_ON))
    {
        o_mirrored = true;
    }

fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief get_ranks_in_pair
/// @tparam T fapi2 Target Type - derived from i_target's type
/// @param[in] i_target the fapi2 target of the mc
/// @param[in] RP rank pair gets ranks in pairs
/// @param[out] o_ranks vector of rank numbers (primary, secondary, tertiary, quaternary)
///
template< fapi2::TargetType T >
inline fapi2::ReturnCode get_ranks_in_pair( const fapi2::Target<T>& i_target,
        const uint64_t& i_rp,
        std::vector<uint64_t>& o_ranks )
{
    // Switches based upon the number of rank pairs
    switch(i_rp)
    {
        case 0:
            FAPI_TRY((get_ranks_in_pair<0, T>(i_target, o_ranks)));
            break;

        case 1:
            FAPI_TRY((get_ranks_in_pair<1, T>(i_target, o_ranks)));
            break;

        case 2:
            FAPI_TRY((get_ranks_in_pair<2, T>(i_target, o_ranks)));
            break;

        case 3:
            FAPI_TRY((get_ranks_in_pair<3, T>(i_target, o_ranks)));
            break;

        // Error case
        default:
            FAPI_ASSERT( false,
                         fapi2::MSS_INVALID_RANK_PAIR()
                         .set_RANK_PAIR(i_rp)
                         .set_MCA_TARGET(i_target)
                         .set_FUNCTION(GET_RANKS_IN_PAIR),
                         "%s Invalid number of rankpairs entered. num: %lu max: %lu",
                         mss::c_str(i_target),
                         i_rp,
                         MAX_PRIMARY_RANKS_PER_PORT);
            break;
    }

    return fapi2::FAPI2_RC_SUCCESS;
fapi_try_exit:
    return fapi2::current_err;
}

///
/// @brief Set rank mirror bits in RANK_GROUP register
/// @tparam RP rank pair (group) index
/// @tparam T fapi2 Target Type - derived from i_target's type
/// @tparam TT traits type defaults to rankPairTraits<T, RP>
/// @param[in] i_target the fapi2 target of the mc
/// @param[in] i_rp_reg_value value of RANK_PAIR register
/// @param[in, out] io_data the register value
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if ok
///
template< uint64_t RP, fapi2::TargetType T, typename TT = rankPairTraits<T, RP> >
fapi2::ReturnCode set_mirror_bits( const fapi2::Target<T>& i_target,
                                   const fapi2::buffer<uint64_t>& i_rp_reg_value,
                                   fapi2::buffer<uint64_t>& io_data );

} // namespace rank

} // namespace mss
#endif


text:
<?php
/**
 * @version    $Id$
 */
class Zyon
{
    /**
     * The version of Zyon
     */
    const VERSION = '0.1 Preview';

    /**
     * import
     *
     * @param string $name
     * @param string $path
     * @return void
     */
    public static function import($name, $path = null)
    {
        if (class_exists($name, false) || interface_exists($name, false))
        {
            return;
        }

        if (preg_match('/[^a-z0-9_\\\\]/i', $name))
        {
            throw new InvalidArgumentException('Security check: Illegal character in filename');
        }

        static $load;
        $load === null AND $load = function(){include_once func_get_arg(0);};

        $file = ltrim(strtr($name, '_\\', DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR) . '.php';
        $path === null OR $file = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $file;

        if ($fp = @fopen($file, 'r', ($path === null)))
        {
            @fclose($fp);
            $load($file);
        }

        if (!class_exists($name, false) && !interface_exists($name, false))
        {
            throw new RuntimeException("File \"{$file}\" does not exist or class \"{$name}\" was not found in the file");
        }
    }

    /**
     * launch
     *
     * @return void
     */
    public static function launch()
    {
        mb_internal_encoding('UTF-8');
        require_once 'Zyon.conf.php';
    }
}
// End of file : Zyon.php


text:
<CartClearResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2011-08-01">
  <OperationRequest>
    <HTTPHeaders>
      <Header Name="UserAgent" Value="Python-urllib/2.6"/>
    </HTTPHeaders>
    <RequestId>04RA5QJF6NJ29X4C9FFD</RequestId>
    <Arguments>
      <Argument Name="AssociateTag" Value="XXXXXXXXXXXXXXX"/>
      <Argument Name="Service" Value="AWSECommerceService"/>
      <Argument Name="Signature" Value="XXXXXXXXXXXXXXX"/>
      <Argument Name="HMAC" Value="nUdgAfC3XUAOWZ+6pm+7767tsfs="/>
      <Argument Name="Operation" Value="CartClear"/>
      <Argument Name="CartId" Value="277-8940399-4864100"/>
      <Argument Name="AWSAccessKeyId" Value="XXXXXXXXXXXXXXX"/>
      <Argument Name="Timestamp" Value="2011-11-08T21:47:34Z"/>
      <Argument Name="Version" Value="2011-08-01"/>
    </Arguments>
    <RequestProcessingTime>0.0545718669891357</RequestProcessingTime>
  </OperationRequest>
  <Cart>
    <Request>
      <IsValid>True</IsValid>
      <CartClearRequest>
        <CartId>277-8940399-4864100</CartId>
        <HMAC>nUdgAfC3XUAOWZ+6pm+7767tsfs=</HMAC>
      </CartClearRequest>
    </Request>
    <CartId>277-8940399-4864100</CartId>
    <HMAC>nUdgAfC3XUAOWZ+6pm+7767tsfs=</HMAC>
    <URLEncodedHMAC>nUdgAfC3XUAOWZ%2B6pm%2B7767tsfs%3D</URLEncodedHMAC>
  </Cart>
</CartClearResponse>


text:
from django.db import models as model_fields
from django.conf import settings
from django.conf.urls import url, include
from django.contrib.auth import models as django_models

from polymorphic.models import PolymorphicModel
from cabot.cabotapp import models, alert
from rest_framework import routers, serializers, viewsets, mixins
import logging

logger = logging.getLogger(__name__)
router = routers.DefaultRouter()

def create_viewset(arg_model, arg_fields, arg_read_only_fields=(), readonly=False):
    arg_read_only_fields = ('id',) + arg_read_only_fields
    for field in arg_read_only_fields:
        if field not in arg_fields:
            arg_fields = arg_fields + (field,)

    class Serializer(serializers.ModelSerializer):
        class Meta:
            model = arg_model
            fields = arg_fields
            read_only_fields = arg_read_only_fields

    viewset_class = None
    if readonly:
        viewset_class = viewsets.ReadOnlyModelViewSet
    else:
        viewset_class = viewsets.ModelViewSet

    class ViewSet(viewset_class):
        queryset = arg_model.objects
        serializer_class = Serializer
        ordering = ['id']
        filter_fields = arg_fields

    return ViewSet

check_group_mixin_fields = (
    'name',
    'users_to_notify',
    'alerts_enabled',
    'status_checks',
    'alerts',
    'hackpad_id',
)

router.register(r'services', create_viewset(
    arg_model=models.Service,
    arg_fields=check_group_mixin_fields + (
        'url',
        'instances',
        'overall_status',
    ),
))

router.register(r'instances', create_viewset(
    arg_model=models.Instance,
    arg_fields=check_group_mixin_fields + (
        'address',
        'overall_status',
    ),
))

status_check_fields = (
    'name',
    'active',
    'importance',
    'frequency',
    'debounce',
    'calculated_status',
)

router.register(r'status_checks', create_viewset(
    arg_model=models.StatusCheck,
    arg_fields=status_check_fields,
    readonly=True,
))

router.register(r'icmp_checks', create_viewset(
    arg_model=models.ICMPStatusCheck,
    arg_fields=status_check_fields,
))

router.register(r'graphite_checks', create_viewset(
    arg_model=models.GraphiteStatusCheck,
    arg_fields=status_check_fields + (
        'metric',
        'check_type',
        'value',
        'expected_num_hosts',
        'allowed_num_failures',
    ),
))

router.register(r'http_checks', create_viewset(
    arg_model=models.HttpStatusCheck,
    arg_fields=status_check_fields + (
        'endpoint',
        'username',
        'password',
        'text_match',
        'status_code',
        'timeout',
        'verify_ssl_certificate',
    ),
))

router.register(r'jenkins_checks', create_viewset(
    arg_model=models.JenkinsStatusCheck,
    arg_fields=status_check_fields + (
        'max_queued_build_time',
        'jenkins_config',
    ),
))

# User API is off by default, could expose/allow modifying dangerous fields
if settings.EXPOSE_USER_API:
    router.register(r'users', create_viewset(
        arg_model=django_models.User,
        arg_fields=(
            'password',
            'is_active',
            'groups',
            #'user_permissions', # Doesn't work, removing for now
            'username',
            'first_name',
            'last_name',
            'email',
        ),
    ))

    router.register(r'user_profiles', create_viewset(
        arg_model=models.UserProfile,
        arg_fields=(
            'user',
            'fallback_alert_user',
        ),
    ))

router.register(r'shifts', create_viewset(
    arg_model=models.Shift,
    arg_fields=(
        'start',
        'end',
        'user',
        'uid',
        'deleted',
    )
))

router.register(r'alertplugins', create_viewset(
    arg_model=alert.AlertPlugin,
    arg_fields=(
            'title',
        ),
    readonly=True
    ))


text:
struct espGwayConfig {
	uint16_t fcnt;				// =0 as init value	XXX Could be 32 bit in size
	uint16_t boots;				// Number of restarts made by the gateway after reset
	uint16_t resets;			// Number of statistics resets
	uint16_t views;				// Number of sendWebPage() calls
	uint16_t wifis;				// Number of WiFi Setups
	uint16_t reents;			// Number of re-entrant interrupt handler calls
	uint16_t ntpErr;			// Number of UTP requests that failed
	uint16_t ntps;

	uint8_t ch;					// index to freqs array, freqs[ifreq]=868100000 default
	uint8_t sf;					// range from SF7 to SF12
	uint8_t debug;				// range 0 to 4

	bool cad;					// is CAD enabled?
	bool hop;					// Is HOP enabled (Note: SHould be disabled)
	bool node;					// Is gateway node enabled
	bool refresh;				// Is WWW browser refresh enabled

	String ssid;				// SSID of the last connected WiFi Network
	String pass;				// Password
} gwayConfig;


text:
require 'set'
require 'open3'

@dry_run = ENV['DRY_RUN']
@verbose = ENV['VERBOSE']

UnitsDir = 'home-files/.config/systemd/user'

# 1. Stop all services from the old generation that are not present in the new generation.
# 2. Ensure all services from the new generation that are wanted by active targets are running:
#    - Start services that are not already running.
#    - Restart services whose unit config files have changed between generations.
# 3. If any services were (re)started, wait 'start_timeout_ms' and report services
#    that failed to start. This helps debugging quickly failing services.
#
# Whenever service failures are detected, show the output of
# 'systemd --user status' for the affected services.
#
def setup_services(old_gen_path, new_gen_path, start_timeout_ms_string)
  start_timeout_ms = start_timeout_ms_string.to_i

  old_units_path = File.join(old_gen_path, UnitsDir) unless old_gen_path.empty?
  new_units_path = File.join(new_gen_path, UnitsDir)

  old_services = get_services(old_units_path)
  new_services = get_services(new_units_path)

  exit if old_services.empty? && new_services.empty?

  all_services = get_active_targets_units(new_units_path)
  maybe_changed = all_services & old_services
  changed_services = get_changed_services(old_units_path, new_units_path, maybe_changed)
  unchanged_oneshots = get_oneshot_services(maybe_changed - changed_services)

  # These services should be running when this script is finished
  services_to_run = all_services - unchanged_oneshots

  # Only stop active services, otherwise we might get a 'service not loaded' error
  # for inactive services that were removed in the current generation.
  to_stop = get_active_units(old_services - new_services)
  to_restart = changed_services
  to_start = get_inactive_units(services_to_run - to_restart)

  raise "daemon-reload failed" unless run_cmd('systemctl', '--user', 'daemon-reload')

  # Exclude units that shouldn't be (re)started or stopped
  no_manual_start, no_manual_stop, no_restart = get_restricted_units(to_stop + to_restart + to_start)
  notify_skipped_units(to_restart & no_restart)
  to_stop -= no_manual_stop
  to_restart -= no_manual_stop + no_manual_start + no_restart
  to_start -= no_manual_start

  if to_stop.empty? && to_start.empty? && to_restart.empty?
    print_service_msg("All services are already running", services_to_run)
  else
    puts "Setting up services" if @verbose
    systemctl_action('stop', to_stop)
    systemctl_action('start', to_start)
    systemctl_action('restart', to_restart)
    started_services = to_start + to_restart
    if start_timeout_ms > 0 && !started_services.empty? && !@dry_run
      failed = wait_and_get_failed_services(started_services, start_timeout_ms)
      if failed.empty?
        print_service_msg("All services are running", services_to_run)
      else
        puts
        puts "Error. These services failed to start:", failed
        show_failed_services_status(failed)
        exit 1
      end
    end
  end
end

def get_services(dir)
  services = get_service_files(dir) if dir && Dir.exists?(dir)
  Set.new(services)
end

def get_service_files(dir)
  Dir.chdir(dir) { Dir['*[^@].{service,socket,timer}'] }
end

def get_changed_services(dir_a, dir_b, services)
  services.select do |service|
    a = File.join(dir_a, service)
    b = File.join(dir_b, service)
    (File.size(a) != File.size(b)) || (File.read(a) != File.read(b))
  end
end

TargetDirRegexp = /^(.*\.target)\.wants$/

# @return all units wanted by active targets
def get_active_targets_units(units_dir)
  return Set.new unless Dir.exists?(units_dir)
  targets = Dir.entries(units_dir).map { |entry| entry[TargetDirRegexp, 1] }.compact
  active_targets = get_active_units(targets)
  active_units = active_targets.map do |target|
    get_service_files(File.join(units_dir, "#{target}.wants"))
  end.flatten
  Set.new(active_units)
end

# @return true on success
def run_cmd(*cmd)
  print_cmd cmd
  @dry_run || system(*cmd)
end

def systemctl_action(cmd, services)
  return if services.empty?

  verb = (cmd == 'stop') ? 'Stopping' : "#{cmd.capitalize}ing"
  puts "#{verb}: #{services.join(' ')}"

  cmd = ['systemctl', '--user', cmd, *services]
  if @dry_run
    puts cmd.join(' ')
    return
  end

  output, status = Open3.capture2e(*cmd)
  print output
  # Show status for failed services
  unless status.success?
    # Due to a bug in systemd, the '--user' argument is not always provided
    output.scan(/systemctl (?:--user )?(status .*?)['"]/).flatten.each do |status_cmd|
      puts
      run_cmd("systemctl --user #{status_cmd}")
    end
    exit 1
  end
end

def systemctl(*cmd)
  output, _ = Open3.capture2('systemctl', '--user', *cmd)
  output
end

def print_cmd(cmd)
  puts [*cmd].join(' ') if @verbose || @dry_run
end

def get_active_units(units)
  filter_units(units) { |state| state == 'active' }
end

def get_inactive_units(units)
  filter_units(units) { |state| state != 'active' }
end

def get_failed_units(units)
  filter_units(units) { |state| state == 'failed' }
end

def filter_units(units)
  return [] if units.empty?
  states = systemctl('is-active', *units).split
  units.select.with_index { |_, i| yield states[i] }
end

def get_oneshot_services(units)
  return [] if units.empty?
  types = systemctl('show', '-p', 'Type', *units).split
  units.select.with_index do |_, i|
    types[i] == 'Type=oneshot'
  end
end

def get_restricted_units(units)
  infos = systemctl('show', '-p', 'RefuseManualStart', '-p', 'RefuseManualStop', *units)
          .split("\n\n")
  no_manual_start = []
  no_manual_stop = []
  infos.zip(units).each do |info, unit|
    no_start, no_stop = info.split("\n")
    no_manual_start << unit if no_start.end_with?('yes')
    no_manual_stop << unit if no_stop.end_with?('yes')
  end
  # Get units that should not be restarted even if a change has been detected.
  no_restart_regexp = /^\s*X-RestartIfChanged\s*=\s*false\b/
  no_restart = units.select { |unit| systemctl('cat', unit) =~ no_restart_regexp }
  [no_manual_start, no_manual_stop, no_restart]
end

def wait_and_get_failed_services(services, start_timeout_ms)
  puts "Waiting #{start_timeout_ms} ms for services to fail"
  # Force the previous message to always be visible before sleeping
  STDOUT.flush
  sleep(start_timeout_ms / 1000.0)
  get_failed_units(services)
end

def show_failed_services_status(services)
  puts
  services.each do |service|
    run_cmd('systemctl', '--user', 'status', service)
    puts
  end
end

def print_service_msg(msg, services)
  return if services.empty?
  if @verbose
    puts "#{msg}:", services.to_a
  else
    puts msg
  end
end

def notify_skipped_units(no_restart)
  puts "Not restarting: #{no_restart.join(' ')}" unless no_restart.empty?
end

setup_services(*ARGV)


text:
package org.chii2.mqtt.common.codec;

import io.netty.buffer.ByteBuf;
import org.chii2.mqtt.common.message.PingRespMessage;

/**
 * PINGRESP Message Encoder
 */
public class PingRespEncoder extends BaseEncoder<PingRespMessage> {

    @Override
    protected void encodeVariableHeader(PingRespMessage message, ByteBuf out) {
        // No Variable Header
    }

    @Override
    protected void encodePayload(PingRespMessage message, ByteBuf out) {
        // No Payload
    }
}


text:
require('babel-core/register')();
require('babel-polyfill');
require('./02-streams/02-02-pipe');


text:
/*  Super Search
    Author: Kushagra Gour (http://kushagragour.in)
    MIT Licensed
*/

(function () {
    var isSearchOpen = false,
        searchEl = document.querySelector('#js-search'),
        searchInputEl = document.querySelector('#js-search__input'),
        searchResultsEl = document.querySelector('#js-search__results'),
        currentInputValue = '',
        lastSearchResultHash,
        posts = [];

    // Changes XML to JSON
    // Modified version from here: http://davidwalsh.name/convert-xml-json
    function xmlToJson(xml) {

        // Create the return object
        var obj = {};

        if (xml.nodeType == 1) { // element
            // do attributes
            if (xml.attributes.length > 0) {
            obj["@attributes"] = {};
                for (var j = 0; j < xml.attributes.length; j++) {
                    var attribute = xml.attributes.item(j);
                    obj["@attributes"][attribute.nodeName] = attribute.nodeValue;
                }
            }
        } else if (xml.nodeType == 3) { // text
            obj = xml.nodeValue;
        }

        // do children
        // If all text nodes inside, get concatenated text from them.
        var textNodes = [].slice.call(xml.childNodes).filter(function (node) { return node.nodeType === 3; });
        if (xml.hasChildNodes() && xml.childNodes.length === textNodes.length) {
            obj = [].slice.call(xml.childNodes).reduce(function (text, node) { return text + node.nodeValue; }, '');
        }
        else if (xml.hasChildNodes()) {
            for(var i = 0; i < xml.childNodes.length; i++) {
                var item = xml.childNodes.item(i);
                var nodeName = item.nodeName;
                if (typeof(obj[nodeName]) == "undefined") {
                    obj[nodeName] = xmlToJson(item);
                } else {
                    if (typeof(obj[nodeName].push) == "undefined") {
                        var old = obj[nodeName];
                        obj[nodeName] = [];
                        obj[nodeName].push(old);
                    }
                    obj[nodeName].push(xmlToJson(item));
                }
            }
        }
        return obj;
    }

    function getPostsFromXml(xml) {
        var json = xmlToJson(xml);
        return json.channel.item;
    }

    var xmlhttp=new XMLHttpRequest();
    xmlhttp.open("GET","/sitemap.xml");
    xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState != 4) return;
        if (xmlhttp.status != 200 && xmlhttp.status != 304) { return; }
        var node = (new DOMParser).parseFromString(xmlhttp.responseText, 'text/xml');
        node = node.children[0];
        posts = getPostsFromXml(node);
    }
    xmlhttp.send();

    window.toggleSearch = function toggleSearch() {
        _gaq.push(['_trackEvent', 'supersearch', searchEl.classList.contains('is-active')]);
        searchEl.classList.toggle('is-active');
        if (searchEl.classList.contains('is-active')) {
            // while opening
            searchInputEl.value = '';
        } else {
            // while closing
            searchResultsEl.classList.add('is-hidden');
        }
        setTimeout(function () {
            searchInputEl.focus();
        }, 210);
    }

    window.addEventListener('keyup', function onKeyPress(e) {
        if (e.which === 27) {
            toggleSearch();
        }
    });
    window.addEventListener('keypress', function onKeyPress(e) {
        if (e.which === 47 && !searchEl.classList.contains('is-active')) {
            toggleSearch();
        }
    });

    searchInputEl.addEventListener('input', function onInputChange() {
        var currentResultHash, d;

        currentInputValue = (searchInputEl.value + '').toLowerCase();
        if (!currentInputValue || currentInputValue.length < 1) {
            lastSearchResultHash = '';
            searchResultsEl.classList.add('is-hidden');
            return;
        }
        searchResultsEl.style.offsetWidth;

        var matchingPosts;
        // check the `posts` object is single or many objects.
        // if posts.title === undefined, so posts is many objects.
        if(posts.title === undefined) {
          matchingPosts = posts.filter(function (post) {
              if ((post.title + '').toLowerCase().indexOf(currentInputValue) !== -1 || (post.description + '').toLowerCase().indexOf(currentInputValue) !== -1) {
                  return true;
              }
          });
        }else {
          matchingPosts = [posts]; // assign single object to Array
        }
        if (!matchingPosts.length) {
            searchResultsEl.classList.add('is-hidden');
        }
        currentResultHash = matchingPosts.reduce(function(hash, post) { return post.title + hash; }, '');
        if (matchingPosts.length && currentResultHash !== lastSearchResultHash) {
            searchResultsEl.classList.remove('is-hidden');
            searchResultsEl.innerHTML = matchingPosts.map(function (post) {
                d = new Date(post.pubDate);
                return '
' + post.title + '' + d.toUTCString().replace(/.*(\d{2})\s+(\w{3})\s+(\d{4}).*/,'$2 $1, $3') + '
';
            }).join('');
        }
        lastSearchResultHash = currentResultHash;
    });

})();


text:
.class public interface abstract Lcom/google/android/gms/ads/internal/client/zzn;
.super Ljava/lang/Object;

# interfaces
.implements Landroid/os/IInterface;

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/google/android/gms/ads/internal/client/zzn$zza;
    }
.end annotation

# virtual methods
.method public abstract onAdClicked()V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation
.end method


text:
<link href="../css/app.css" rel="stylesheet" type="text/css" />

Get a recommendation

Please select a location (drag and resize the circle):

      <map center="{{[ bucharestLat, bucharestLng ]}}" zoom="12">

        <shape ng-model="$parent.circle" name="circle"
        stroke-color="#FF0000" stroke-opacity="0.8" stroke-weight="2"
        fill-color="#FF0000" fill-opacity="0.35"
        editable="true"
        center="{{[ bucharestLat, bucharestLng ]}}" radius="1500">
        </shape>
      </map>

Please select cuisines:

      <ui-select
        ng-model="$parent.selectedCuisines"
        multiple
        theme="bootstrap">
          <ui-select-match placeholder="Enter some cuisines...">{{ $item.name }}</ui-select-match>
          <ui-select-choices repeat="cuisine in cuisines track by cuisine.id">

{{ cuisine.name }}

          </ui-select-choices>
      </ui-select>

Please select location types:

      <ui-select
        ng-model="$parent.selectedLocationTypes"
        multiple
        theme="bootstrap">
          <ui-select-match placeholder="Enter some location types...">{{ $item.name }}</ui-select-match>
          <ui-select-choices repeat="locationType in locationTypes track by locationType.id">

{{ locationType.name }}

          </ui-select-choices>
      </ui-select>

      <button class="btn btn-primary btn-lg pull-right" ng-click="save()">Recommend</button>


text:
package edu.berkeley.nlp.util;

import java.io.Serializable;

/**
 * Just a dummy class. TODO: move common functionality here.
 */
public abstract class AbstractTMap<T> implements Serializable {
	protected static final long serialVersionUID = 42;

	public static class Functionality<T> implements Serializable {
		public T[] createArray(int n) {
			return (T[]) (new Object[n]);
		}

		public T intern(T x) {
			return x;
		} // Override to get desired behavior, e.g., interning
	}

	public static class ObjectFunctionality extends Functionality<Object> {
		@Override
		public Object[] createArray(int n) {
			return new Object[n];
		}
	}

	public static Functionality defaultFunctionality = new Functionality();

	protected static final int growFactor = 2; // How much extra space (times
												// size) to give for the
												// capacity
	protected static final int defaultExpectedSize = 2;
	protected static final double loadFactor = 0.75; // For hash table

	protected enum MapType {
		SORTED_LIST, HASH_TABLE
	}

	protected MapType mapType;
	protected boolean locked; // Are the keys locked
	protected int num;
	protected T[] keys;
	protected Functionality<T> keyFunc;
	protected int numCollisions; // For debugging
}


text:
using System;

namespace SampleApplication.Modules.ModuleC.Services
{
    public interface IModuleCService
    {
        void NewModuleCTab();

        void DuplicateModuleCTab(Guid tabId);
    }
}


text:
require 'spec_helper'
require 'argument_processor.rb'

describe ArgumentProcessor do
  describe 'process_args' do
    context 'when no arguments are passed' do
      it 'expects the help switch to be included in the return' do
        expect(subject.process_args([])).to eq({:switches =>{},:commands=>["--help"],:errors=>[]})
      end
    end
    context 'when an invalid argument is passed' do
      it 'expects values to include an error in the return' do
        expect(subject.process_args(["-z"])).to eq({:commands=>["--help"],:switches=>{},:errors=>["invalid switch"]})
      end
    end
    context 'when a valid argument is passed' do
      it 'expects values to include the correct switch and value in the return' do
        expect(subject.process_args(["-t","test"])).to eq({:commands=>[],:switches=>{"-t"=>"test"},:errors=>[]})
      end
    end
    context 'when 2 valid arguments are passed' do
      it 'expects values to include the correct switches and values in the return' do
        expect(subject.process_args(["-t","test","-d","my_database"])).to eq({:commands=>[],:switches=>{"-t"=>"test","-d"=> "my_database"},:errors=>[]})
      end
    end
  end
end


text:
Dedicated calendar for SportShifter project. Work in progress...

## Install

```shell
bower install kkolada/ui-shifter-calendar
```

## Usage
1. Include the `uiShifterCalendar.js` script provided by this component into your app.
2. Add `UI.Shifter.Calendar` as a module dependency to your app.

Insert directive into your app (attribute or element).
```html
<div ui-shifter-calendar></div>
<ui-shifter-calendar></ui-shifter-calendar>
```


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>com.google.code.play2.spm.template (Play! 2.x Source Position Mappers 1.0.0-rc5 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Package com.google.code.play2.spm.template

<map id="G" name="G">
<area shape="rect" id="node1_0" href="./Play2TemplateSourcePositionMapper.html" title="com.google.code.play2.spm.template.Play2TemplateSourcePositionMapper" alt="" coords="16,17,252,42"/>
<area shape="rect" id="node1" href="./Play2TemplateSourcePositionMapper.html" title="<TABLE>" alt="" coords="5,5,263,53"/>
<area shape="rect" id="node2_1" href="./Play2TemplateSourcePosition.html" title="com.google.code.play2.spm.template.Play2TemplateSourcePosition" alt="" coords="297,17,491,42"/>
<area shape="rect" id="node2" href="./Play2TemplateSourcePosition.html" title="<TABLE>" alt="" coords="287,5,501,53"/>
<area shape="rect" id="node3_2" href="./Play2TemplateGeneratedSource.html" title="com.google.code.play2.spm.template.Play2TemplateGeneratedSource" alt="" coords="536,17,743,42"/>
<area shape="rect" id="node3" href="./Play2TemplateGeneratedSource.html" title="<TABLE>" alt="" coords="525,5,753,53"/>
</map>

Class Summary

Class
Description

Play2TemplateGeneratedSource

Play2TemplateSourcePosition

Play2TemplateSourcePositionMapper

Play! Framework template source position mapper

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Copyright © 2013–2019. All rights reserved.


text:
/* Generated By:JJTree: Do not edit this line. ASTValueInt.java Version 4.3 */
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=true,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
/*
 * (c) Copyright FOCONIS AG, 2014
 *
 * 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.
 */
package org.openntf.formula.ast;

import org.openntf.formula.FormulaContext;
import org.openntf.formula.ValueHolder;
import org.openntf.formula.parse.AtFormulaParserImpl;

public class ASTValueInt extends SimpleNode {
	private ValueHolder value;

	public ASTValueInt(final AtFormulaParserImpl p, final int id) {
		super(p, id);
	}

	public void parseInt(final String image) {
		Number n = parser.getFormatter().parseNumber(image);
		if (n instanceof Integer)
			value = ValueHolder.valueOf(n.intValue());
		else
			value = ValueHolder.valueOf(n.doubleValue());
	}

	@Override
	public String toString() {
		return super.toString() + ": " + value; //$NON-NLS-1$
	}

	@Override
	public ValueHolder evaluate(final FormulaContext ctx) {
		return value;
	}

}
/* JavaCC - OriginalChecksum=19609d291368534191c28631651790db (do not edit this line) */