From 86e1b52c812f5d9680ec1ad755d80644d0736a07 Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Fri, 23 Mar 2018 23:00:16 -0700 Subject: renamed DataItemIndex and ClientIndex files and moved them into utils. Change-Id: I138471168bf58d2cf09c6a435088edea29a567d0 CRs-Fixed: 2218519 --- core/data-items/common/ClientIndex.h | 70 ---------------------------------- core/data-items/common/DataItemIndex.h | 70 ---------------------------------- utils/LocListMap.h | 70 ++++++++++++++++++++++++++++++++++ utils/LocUnorderedSetMap.h | 70 ++++++++++++++++++++++++++++++++++ utils/Makefile.am | 3 +- 5 files changed, 142 insertions(+), 141 deletions(-) delete mode 100644 core/data-items/common/ClientIndex.h delete mode 100644 core/data-items/common/DataItemIndex.h create mode 100644 utils/LocListMap.h create mode 100644 utils/LocUnorderedSetMap.h diff --git a/core/data-items/common/ClientIndex.h b/core/data-items/common/ClientIndex.h deleted file mode 100644 index feccb05..0000000 --- a/core/data-items/common/ClientIndex.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright (c) 2015, 2017 The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -#ifndef __CLIENTINDEX_H__ -#define __CLIENTINDEX_H__ - -#include -#include -#include - -using loc_core::IClientIndex; - -namespace loc_core -{ - -template - -class ClientIndex : public IClientIndex { - -public: - - ClientIndex (); - - ~ClientIndex (); - - bool isSubscribedClient (CT client); - - void getSubscribedList (CT client, std :: list & out); - - int remove (CT client); - - void remove (const std :: list & r, std :: list & out); - - void remove (CT client, const std :: list & r, std :: list & out); - - void add (CT client, const std :: list & l, std :: list & out); - -private: - //Data members - std :: map < CT , std :: list > mDataItemsPerClientMap; -}; - -} // namespace loc_core - -#endif // #ifndef __CLIENTINDEX_H__ diff --git a/core/data-items/common/DataItemIndex.h b/core/data-items/common/DataItemIndex.h deleted file mode 100644 index d72e89e..0000000 --- a/core/data-items/common/DataItemIndex.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright (c) 2015, 2017 The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __DATAITEMINDEX_H__ -#define __DATAITEMINDEX_H__ - -#include -#include -#include - -using loc_core::IDataItemIndex; - -namespace loc_core -{ - -template - -class DataItemIndex : public IDataItemIndex { - -public: - - DataItemIndex (); - - ~DataItemIndex (); - - void getListOfSubscribedClients (DIT id, std :: list & out); - - int remove (DIT id); - - void remove (const std :: list & r, std :: list & out); - - void remove (DIT id, const std :: list & r, std :: list & out); - - void add (DIT id, const std :: list & l, std :: list & out); - - void add (CT client, const std :: list & l, std :: list & out); - -private: - std :: map < DIT, std :: list > mClientsPerDataItemMap; -}; - -} // namespace loc_core - -#endif // #ifndef __DATAITEMINDEX_H__ diff --git a/utils/LocListMap.h b/utils/LocListMap.h new file mode 100644 index 0000000..feccb05 --- /dev/null +++ b/utils/LocListMap.h @@ -0,0 +1,70 @@ +/* Copyright (c) 2015, 2017 The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __CLIENTINDEX_H__ +#define __CLIENTINDEX_H__ + +#include +#include +#include + +using loc_core::IClientIndex; + +namespace loc_core +{ + +template + +class ClientIndex : public IClientIndex { + +public: + + ClientIndex (); + + ~ClientIndex (); + + bool isSubscribedClient (CT client); + + void getSubscribedList (CT client, std :: list & out); + + int remove (CT client); + + void remove (const std :: list & r, std :: list & out); + + void remove (CT client, const std :: list & r, std :: list & out); + + void add (CT client, const std :: list & l, std :: list & out); + +private: + //Data members + std :: map < CT , std :: list > mDataItemsPerClientMap; +}; + +} // namespace loc_core + +#endif // #ifndef __CLIENTINDEX_H__ diff --git a/utils/LocUnorderedSetMap.h b/utils/LocUnorderedSetMap.h new file mode 100644 index 0000000..d72e89e --- /dev/null +++ b/utils/LocUnorderedSetMap.h @@ -0,0 +1,70 @@ +/* Copyright (c) 2015, 2017 The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __DATAITEMINDEX_H__ +#define __DATAITEMINDEX_H__ + +#include +#include +#include + +using loc_core::IDataItemIndex; + +namespace loc_core +{ + +template + +class DataItemIndex : public IDataItemIndex { + +public: + + DataItemIndex (); + + ~DataItemIndex (); + + void getListOfSubscribedClients (DIT id, std :: list & out); + + int remove (DIT id); + + void remove (const std :: list & r, std :: list & out); + + void remove (DIT id, const std :: list & r, std :: list & out); + + void add (DIT id, const std :: list & l, std :: list & out); + + void add (CT client, const std :: list & l, std :: list & out); + +private: + std :: map < DIT, std :: list > mClientsPerDataItemMap; +}; + +} // namespace loc_core + +#endif // #ifndef __DATAITEMINDEX_H__ diff --git a/utils/Makefile.am b/utils/Makefile.am index 3801fdd..33afc1b 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -28,7 +28,8 @@ libgps_utils_la_h_sources = \ gps_extended_c.h \ gps_extended.h \ loc_gps.h \ - log_util.h + log_util.h \ + LocUnorderedSetMap.h libgps_utils_la_c_sources = \ linked_list.c \ -- cgit v1.2.3