001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005package edu.wpi.first.networktables; 006 007/** Network table data types. */ 008public enum NetworkTableType { 009 kUnassigned(0), 010 kBoolean(0x01), 011 kDouble(0x02), 012 kString(0x04), 013 kRaw(0x08), 014 kBooleanArray(0x10), 015 kDoubleArray(0x20), 016 kStringArray(0x40), 017 kRpc(0x80); 018 019 private final int value; 020 021 NetworkTableType(int value) { 022 this.value = value; 023 } 024 025 public int getValue() { 026 return value; 027 } 028 029 /** 030 * Convert from the numerical representation of type to an enum type. 031 * 032 * @param value The numerical representation of kind 033 * @return The kind 034 */ 035 public static NetworkTableType getFromInt(int value) { 036 switch (value) { 037 case 0x01: 038 return kBoolean; 039 case 0x02: 040 return kDouble; 041 case 0x04: 042 return kString; 043 case 0x08: 044 return kRaw; 045 case 0x10: 046 return kBooleanArray; 047 case 0x20: 048 return kDoubleArray; 049 case 0x40: 050 return kStringArray; 051 case 0x80: 052 return kRpc; 053 default: 054 return kUnassigned; 055 } 056 } 057}