WPILib 2012
WPILibRoboticsLibraryforFRC
SmartDashboard/SendableChooser.h
00001 /*----------------------------------------------------------------------------*/
00002 /* Copyright (c) FIRST 2011. All Rights Reserved.                                                         */
00003 /* Open Source Software - may be modified and shared by FRC teams. The code   */
00004 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */
00005 /*----------------------------------------------------------------------------*/
00006 
00007 #ifndef __SENDABLE_CHOOSER_H__
00008 #define __SENDABLE_CHOOSER_H__
00009 
00010 #include "SmartDashboard/SmartDashboardData.h"
00011 #include <map>
00012 #include <string>
00013 
00014 class NetworkTable;
00015 
00028 class SendableChooser : public SmartDashboardData
00029 {
00030 public:
00031         SendableChooser();
00032         virtual ~SendableChooser() {};
00033 
00034         void AddObject(const char *name, void *object);
00035         void AddDefault(const char *name, void *object);
00036         void *GetSelected();
00037 
00038         // SmartDashboardData interface
00039         virtual std::string GetType() {return "String Chooser";}
00040         virtual NetworkTable *GetTable() {return m_table;}
00041 
00042 private:
00043         void *m_defaultChoice;
00044         std::map<std::string, void *> m_choices;
00045         std::map<void *, std::string> m_ids;
00046         NetworkTable *m_table;
00047         int m_count;
00048 };
00049 
00050 #endif
 All Classes Functions Variables